Browse Source

Merge branch 'dev' into pre-production

master
zhenghaoyu 10 months ago
parent
commit
389afcb524
  1. 3
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAllocationClient.java
  2. 3
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java
  3. 5
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  4. 18
      blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataMessageSender.java
  5. 2
      blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java
  6. 8
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataGoodsAllocationClient.java
  7. 9
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java
  8. 14
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  9. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.java
  10. 19
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml
  11. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionParcelListService.java
  12. 830
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  13. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java
  14. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java
  15. 8
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml
  16. 5
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java
  17. 18
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml
  18. 2
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java
  19. 5
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java
  20. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java
  21. 11
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java
  22. 296
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java
  23. 74
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownGoodsServiceImpl.java
  24. 363
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

3
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsAllocationClient.java

@ -72,4 +72,7 @@ public interface IBasicdataGoodsAllocationClient {
@GetMapping(API_PREFIX+"/findStockUpAllocationById") @GetMapping(API_PREFIX+"/findStockUpAllocationById")
BasicdataGoodsAllocationEntity findStockUpAllocationById(@RequestParam Long warehouseId,@RequestParam Long stockUpAllocationId); BasicdataGoodsAllocationEntity findStockUpAllocationById(@RequestParam Long warehouseId,@RequestParam Long stockUpAllocationId);
@PostMapping(API_PREFIX+"/updateListAllocationStatus")
void updateListAllocationStatus(@RequestParam List<Long> updateAllocationIds, @RequestParam String allocationStatus);
} }

3
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java

@ -79,4 +79,7 @@ public interface IBasicdataTrayClient {
*/ */
@GetMapping(API_PREFIX+"/findByTrayName") @GetMapping(API_PREFIX+"/findByTrayName")
BasicdataTrayEntity findByTrayName(@RequestParam String positions); BasicdataTrayEntity findByTrayName(@RequestParam String positions);
@PostMapping(API_PREFIX+"/updateTrayStatusByTrayIds")
void updateTrayStatusByTrayIds(@RequestParam List<Long> trayIds, @RequestParam int trayStatus);
} }

5
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -192,4 +192,9 @@ public interface IDistributionParcelListClient {
@PostMapping(API_PREFIX + "/findListByOrderCodesAndWarehouseId") @PostMapping(API_PREFIX + "/findListByOrderCodesAndWarehouseId")
List<DistributionParcelListEntity> findListByOrderCodesAndWarehouseId(@RequestParam Set<String> orderCodeSet, @RequestParam Long warehouseId); List<DistributionParcelListEntity> findListByOrderCodesAndWarehouseId(@RequestParam Set<String> orderCodeSet, @RequestParam Long warehouseId);
@PostMapping(API_PREFIX + "/findListByOrderPackageCodeList")
List<DistributionParcelListEntity> findListByOrderPackageCodeList(@RequestParam List<String> orderPackageCodeList, @RequestParam Long warehouseId);
@PostMapping(API_PREFIX + "/findALLNoUpShelfPackageByOrderCodeList")
List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(@RequestParam List<String> orderCodeList, @RequestParam Long warehouseId);
} }

18
blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataMessageSender.java

@ -1,11 +1,14 @@
package com.logpm.factorydata.util; package com.logpm.factorydata.util;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.json.JSONUtil; import cn.hutool.json.JSONUtil;
import com.logpm.factorydata.feign.IFactoryDataClient; import com.logpm.factorydata.feign.IFactoryDataClient;
import com.logpm.factorydata.vo.NodePushMsg; import com.logpm.factorydata.vo.NodePushMsg;
import com.logpm.factorydata.vo.SendMsg; import com.logpm.factorydata.vo.SendMsg;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.factorydata.FactoryDataConstants; import org.springblade.common.constant.factorydata.FactoryDataConstants;
import org.springblade.common.utils.HutoolConfigUtil; import org.springblade.common.utils.HutoolConfigUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
@ -17,6 +20,7 @@ import org.springframework.stereotype.Component;
@Component @Component
@Builder @Builder
@AllArgsConstructor @AllArgsConstructor
@Slf4j
public class FactoryDataMessageSender { public class FactoryDataMessageSender {
private final IFactoryDataClient factoryDataClient; private final IFactoryDataClient factoryDataClient;
@ -27,9 +31,17 @@ public class FactoryDataMessageSender {
* @param data * @param data
*/ */
public void sendNodeDataByBrand(NodePushMsg data) { public void sendNodeDataByBrand(NodePushMsg data) {
String routingKeyByName = FactoryDataUtil.findRoutingKeyByName(data.getBrand()); try{
SendMsg build = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.NODE_DATA_PUSH).routingKey(routingKeyByName).message(JSONUtil.toJsonStr(data, HutoolConfigUtil.jsonConfigByDataTimeFormat())).build(); String routingKeyByName = FactoryDataUtil.findRoutingKeyByName(data.getBrand());
factoryDataClient.sendMessage(build); if(StrUtil.isEmpty(routingKeyByName)){
return ;
}
SendMsg build = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.NODE_DATA_PUSH).routingKey(routingKeyByName).message(JSONUtil.toJsonStr(data, HutoolConfigUtil.jsonConfigByDataTimeFormat())).build();
factoryDataClient.sendMessage(build);
}catch (Exception e){
log.error("sendNodeDataByBrand >>>>" ,e);
}
} }
} }

2
blade-service-api/logpm-factory-data-api/src/main/java/com/logpm/factorydata/util/FactoryDataUtil.java

@ -35,7 +35,7 @@ public class FactoryDataUtil {
* @return 指定路由key * @return 指定路由key
*/ */
public static String findRoutingKeyByName(BrandEnums brand) { public static String findRoutingKeyByName(BrandEnums brand) {
if (ObjectUtil.hasNull(brand, factorys.get(brand.getValue()))) { if (ObjectUtil.isEmpty(brand) || ObjectUtil.isEmpty(factorys.get(brand.getValue()))) {
// TODO 业务调用不规范,特殊处理 // TODO 业务调用不规范,特殊处理
return null; return null;
} }

8
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataGoodsAllocationClient.java

@ -114,4 +114,12 @@ public class BasicdataGoodsAllocationClient implements IBasicdataGoodsAllocation
return BasicdataGoodsAllocationService.findStockUpAllocationById(warehouseId,stockUpAllocationId); return BasicdataGoodsAllocationService.findStockUpAllocationById(warehouseId,stockUpAllocationId);
} }
@Override
public void updateListAllocationStatus(List<Long> updateAllocationIds, String allocationStatus) {
UpdateWrapper<BasicdataGoodsAllocationEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("allocation_status",allocationStatus)
.in("id",updateAllocationIds);
BasicdataGoodsAllocationService.update(updateWrapper);
}
} }

9
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java

@ -116,4 +116,13 @@ public class BasicdataTrayClient implements IBasicdataTrayClient {
).get(0); ).get(0);
} }
@Override
public void updateTrayStatusByTrayIds(List<Long> trayIds, int trayStatus) {
UpdateWrapper<BasicdataTrayEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("tray_status",trayStatus)
.in("id",trayIds)
.eq("is_deleted",0);
basicdataTrayService.update(updateWrapper);
}
} }

14
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -430,4 +430,18 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
return distributionParcelListService.list(queryWrapper); return distributionParcelListService.list(queryWrapper);
} }
@Override
public List<DistributionParcelListEntity> findListByOrderPackageCodeList(List<String> orderPackageCodeList, Long warehouseId) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.in("order_package_code", orderPackageCodeList)
.eq("warehouse_id", warehouseId);
return distributionParcelListService.list(queryWrapper);
}
@Override
public List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(List<String> orderCodeList, Long warehouseId) {
return distributionParcelListService.findALLNoUpShelfPackageByOrderCodeList(orderCodeList,warehouseId);
}
} }

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

@ -277,4 +277,6 @@ public interface DistributionParcelListMapper extends BaseMapper<DistributionPar
void removePakcageByAdvanceIds(@Param("advanceIds") List<Long> advanceIds, @Param("warehouseId") Long warehouseId); void removePakcageByAdvanceIds(@Param("advanceIds") List<Long> advanceIds, @Param("warehouseId") Long warehouseId);
List<Map<String, String>> findPackageCodeByCodes(@Param("keySet") Set<String> keySet); List<Map<String, String>> findPackageCodeByCodes(@Param("keySet") Set<String> keySet);
List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(@Param("orderCodeList") List<String> orderCodeList, @Param("warehouseId") Long warehouseId);
} }

19
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionParcelListMapper.xml

@ -1765,4 +1765,23 @@
</foreach> </foreach>
</delete> </delete>
<select id="findALLNoUpShelfPackageByOrderCodeList"
resultType="com.logpm.distribution.entity.DistributionParcelListEntity">
select ldpl.*
from logpm_distribution_parcel_list ldpl
left join logpm_warehouse_tray_goods lwtg on lwtg.association_value = ldpl.order_package_code
left join logpm_warehouse_updown_goods lwug on lwug.association_value = ldpl.order_package_code
where 1 = 1
and ldpl.order_code in
<foreach collection="orderCodeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
and ldpl.warehouse_id = #{warehouseId}
and lwtg.id is null
and lwug.id is null
</select>
</mapper> </mapper>

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

@ -242,4 +242,6 @@ public interface IDistributionParcelListService extends BaseService<Distribution
* @return * @return
*/ */
Map<String, Set<String>> findPackageCodeByCodes(Set<String> keySet); Map<String, Set<String>> findPackageCodeByCodes(Set<String> keySet);
List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(List<String> orderCodeList, Long warehouseId);
} }

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

@ -581,23 +581,23 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
@Override @Override
@Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class) @Transactional(isolation = Isolation.READ_COMMITTED, rollbackFor = Exception.class)
// synchronized // synchronized
public R loadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) { public R loadingscan(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO) {
//查询该包件是否能够从库存品包件表中查到 try{
String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()); //查询该包件是否能够从库存品包件表中查到
String now = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date());
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse(); BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if (Objects.isNull(myCurrentWarehouse)) { if (Objects.isNull(myCurrentWarehouse)) {
throw new CustomerException(403, "仓库信息不能为空"); throw new CustomerException(403, "仓库信息不能为空");
} }
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())){ if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())){
DistributionReservationEntity distributionReservation = distributionReservationService.getById(distrilbutionloadingscanDTO.getReservationId()); DistributionReservationEntity distributionReservation = distributionReservationService.getById(distrilbutionloadingscanDTO.getReservationId());
if (ReservationStatusConstant.yiquexiao.getValue().equals(distributionReservation.getReservationStatus())){ if (ReservationStatusConstant.yiquexiao.getValue().equals(distributionReservation.getReservationStatus())){
throw new CustomerException(403, "预约单已取消"); throw new CustomerException(403, "预约单已取消");
}
} }
}
// -----------------------------------2023-09-25 签收调整---------------------------------------------------------------- // -----------------------------------2023-09-25 签收调整----------------------------------------------------------------
@ -606,457 +606,463 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// 如果属于该客户则进行装车扫描 // 如果属于该客户则进行装车扫描
// //
//获取当前用户司机 //获取当前用户司机
DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId()); DistributionDeliveryListEntity distributionDeliveryListEntity = distributionDeliveryListMapper.selectById(distrilbutionloadingscanDTO.getDeliveryId());
//异步确认包条扫描信息 //异步确认包条扫描信息
// distributionAsyncService.changeOrderSignforStatus(distrilbutionloadingscanDTO.getBarcode()); // distributionAsyncService.changeOrderSignforStatus(distrilbutionloadingscanDTO.getBarcode());
List<Long> packageLockIds = new ArrayList<>(); List<Long> packageLockIds = new ArrayList<>();
List<JSONObject> jsonObjects = new ArrayList<>(); List<JSONObject> jsonObjects = new ArrayList<>();
List<JSONObject> aaa = new ArrayList<>(); List<JSONObject> aaa = new ArrayList<>();
List<String> orderPackageCodes = new ArrayList<>(); List<String> orderPackageCodes = new ArrayList<>();
DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity(); DistributionDeliverySelfEntity distributionDeliverySelfEntity = new DistributionDeliverySelfEntity();
if ("1".equals(distributionDeliveryListEntity.getKind())) { if ("1".equals(distributionDeliveryListEntity.getKind())) {
if (!Objects.isNull(distrilbutionloadingscanDTO.getLoadingId())) { if (!Objects.isNull(distrilbutionloadingscanDTO.getLoadingId())) {
distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectById(distrilbutionloadingscanDTO.getLoadingId()); distributionDeliverySelfEntity = distributionDeliverySelfMapper.selectById(distrilbutionloadingscanDTO.getLoadingId());
if (Func.isEmpty(distributionDeliverySelfEntity)) { if (Func.isEmpty(distributionDeliverySelfEntity)) {
//通过装车扫描传递的车次ID发生变化,提示文员进行计划变更 //通过装车扫描传递的车次ID发生变化,提示文员进行计划变更
return Resp.scanFail(13000, null, null, null); return Resp.scanFail(13000, null, null, null);
}
} }
} else {
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectById(distrilbutionloadingscanDTO.getLoadingId());
BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity);
} }
} else { List<DistributionParcelListEntity> pushList = new ArrayList<>();
DistributionDeliveryTripartiteEntity distributionDeliveryTripartiteEntity = distributionDeliveryTripartiteMapper.selectById(distrilbutionloadingscanDTO.getLoadingId()); if (distrilbutionloadingscanDTO.getType() == 1) {
BeanUtils.copyProperties(distributionDeliveryTripartiteEntity, distributionDeliverySelfEntity); List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda()
} .eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode())
List<DistributionParcelListEntity> pushList = new ArrayList<>(); .ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue())
if (distrilbutionloadingscanDTO.getType() == 1) { );
List<DisStockListDetailEntity> list = disStockListDetailService.list(Wrappers.<DisStockListDetailEntity>query().lambda() if (Func.isNotEmpty(list)) {
.eq(DisStockListDetailEntity::getStockPackageCode, distrilbutionloadingscanDTO.getBarcode()) //满足条件此码必定为库存品
.ne(DisStockListDetailEntity::getStockPackageStatus, ReservationPackageStatusConstant.quxiao.getValue()) //判断该库存品是否属于当前客户
); List<DisStockListDetailEntity> collect = list.stream().filter(l -> l.getReservationId().equals(distrilbutionloadingscanDTO.getReservationId())).collect(Collectors.toList());
if (Func.isNotEmpty(list)) { if (Func.isNotEmpty(collect)) {
//满足条件此码必定为库存品 return Resp.scanFail("请在库存品页面扫描此码", "请在库存品页面扫描此码");
//判断该库存品是否属于当前客户 }
List<DisStockListDetailEntity> collect = list.stream().filter(l -> l.getReservationId().equals(distrilbutionloadingscanDTO.getReservationId())).collect(Collectors.toList()); return Resp.scanFail("此码不是订制品", "此码不是订制品");
if (Func.isNotEmpty(collect)) {
return Resp.scanFail("请在库存品页面扫描此码", "请在库存品页面扫描此码");
} }
return Resp.scanFail("此码不是订制品", "此码不是订制品"); //查询当前扫描的包件是否进行了装车
} DistributionParcelListEntity parcelList = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId());
//查询当前扫描的包件是否进行了装车 if (Func.isEmpty(parcelList)){
DistributionParcelListEntity parcelList = distributionParcelListService.selectByOrderPackageCode(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId()); return Resp.scanFail("系统无编码", "系统无编码");
if (Func.isEmpty(parcelList)){
return Resp.scanFail("系统无编码", "系统无编码");
}
if (!Objects.isNull(parcelList)) {
if (OrderPackageStatusConstant.yiqianshou.getValue().equals(parcelList.getOrderPackageStatus())) {
return Resp.scanFail("包件已签收", "包件已签收");
} }
} if (!Objects.isNull(parcelList)) {
if (!Objects.isNull(parcelList)) { if (OrderPackageStatusConstant.yiqianshou.getValue().equals(parcelList.getOrderPackageStatus())) {
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelList.getOrderPackageLoadingStatus())) { return Resp.scanFail("包件已签收", "包件已签收");
return Resp.scanFail("包件已装车", "包件已装车"); }
}
if (!Objects.isNull(parcelList)) {
if (OrderPackageLoadingStatusConstant.yizhuangche.getValue().equals(parcelList.getOrderPackageLoadingStatus())) {
return Resp.scanFail("包件已装车", "包件已装车");
}
} }
}
List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda() List<DistributionLoadscanAbnormalEntity> abnormalEntities = distributionLoadscanAbnormalService.list(Wrappers.<DistributionLoadscanAbnormalEntity>query().lambda()
.eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode()) .eq(DistributionLoadscanAbnormalEntity::getPackageCode, distrilbutionloadingscanDTO.getBarcode())
.eq(DistributionLoadscanAbnormalEntity::getPackageId, parcelList.getId()) .eq(DistributionLoadscanAbnormalEntity::getPackageId, parcelList.getId())
); );
if (!abnormalEntities.isEmpty()) { if (!abnormalEntities.isEmpty()) {
//判断异常是否属于自身 //判断异常是否属于自身
boolean flag = abnormalEntities.stream().allMatch(a -> !distributionDeliveryListEntity.getId().equals(a.getDeliveryListId()) || !distrilbutionloadingscanDTO.getReservationId().equals(a.getReservationId())); boolean flag = abnormalEntities.stream().allMatch(a -> !distributionDeliveryListEntity.getId().equals(a.getDeliveryListId()) || !distrilbutionloadingscanDTO.getReservationId().equals(a.getReservationId()));
if (flag){ if (flag){
//该异常属于其他车次 //该异常属于其他车次
String collect = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getTrainNumber).collect(Collectors.joining(",")); String collect = abnormalEntities.stream().map(DistributionLoadscanAbnormalEntity::getTrainNumber).collect(Collectors.joining(","));
log.info("包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}",distributionDeliveryListEntity.getTrainNumber(),collect); log.info("包件已在其他车次存在异常 >>>>当前车次:{},其他车次:{}",distributionDeliveryListEntity.getTrainNumber(),collect);
return Resp.scanFail("包件已在其他车次存在异常", "包件已在其他车次存在异常"); return Resp.scanFail("包件已在其他车次存在异常", "包件已在其他车次存在异常");
}
} }
}
List<DistributionParcelListEntity> distributionParcelListEntities = distributionDeliveryListMapper.selectPackageListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId()); List<DistributionParcelListEntity> distributionParcelListEntities = distributionDeliveryListMapper.selectPackageListByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())) { if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())) {
//在客户列表进行装车 //在客户列表进行装车
distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId()); distributionParcelListEntities = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
}
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListEntities.stream().filter(p -> Func.equals(p.getOrderPackageCode(), distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
if (parcelListEntityList.size() == 1) {
//在配送任务中存在该包件的计划
List<DistributionLoadscanEntity> distributionLoadscanEntitiesflag = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()).eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
if (Func.isNotEmpty(distributionLoadscanEntitiesflag) && distributionLoadscanEntitiesflag.size() == 1) {
return Resp.scanFail("重复扫码", "重复扫码");
} }
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListEntities.stream().filter(p -> Func.equals(p.getOrderPackageCode(), distrilbutionloadingscanDTO.getBarcode())).collect(Collectors.toList());
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDeliveryId())) { if (parcelListEntityList.size() == 1) {
loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); //在配送任务中存在该包件的计划
} List<DistributionLoadscanEntity> distributionLoadscanEntitiesflag = distributionLoadscanMapper.selectList(new QueryWrapper<DistributionLoadscanEntity>().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()).eq(DistributionLoadscanEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()).ne(DistributionLoadscanEntity::getScanStatus, LoadingStatusConstant.quxiao.getValue()));
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { if (Func.isNotEmpty(distributionLoadscanEntitiesflag) && distributionLoadscanEntitiesflag.size() == 1) {
loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); return Resp.scanFail("重复扫码", "重复扫码");
} }
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity();
loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); if (Func.isNotEmpty(distributionDeliverySelfEntity.getDeliveryId())) {
} loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { }
loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
} loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { }
loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) {
} loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
DistributionParcelListEntity parcelListEntity = parcelListEntityList.get(0); }
//添加车次号 if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) {
loadscanEntity.setTrainNumber(distributionDeliveryListEntity.getTrainNumber()); loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
loadscanEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue()); }
loadscanEntity.setScanType("1"); if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) {
loadscanEntity.setOneClick(1); loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
loadscanEntity.setWarehouseId(myCurrentWarehouse.getId()); }
loadscanEntity.setWarehouseName(myCurrentWarehouse.getName()); DistributionParcelListEntity parcelListEntity = parcelListEntityList.get(0);
loadscanEntity.setPackageId(parcelListEntity.getId()); //添加车次号
loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode()); loadscanEntity.setTrainNumber(distributionDeliveryListEntity.getTrainNumber());
loadscanEntity.setPackageNub(parcelListEntity.getQuantity()); loadscanEntity.setScanStatus(LoadingStatusConstant.saomiao.getValue());
DistributionReservationEntity reservationEntity = distributionDeliveryListMapper.selectReservationByPackageAndDeliveryId(parcelListEntity.getOrderPackageCode(), distrilbutionloadingscanDTO.getDeliveryId()); loadscanEntity.setScanType("1");
loadscanEntity.setOneClick(1);
loadscanEntity.setReservationId(reservationEntity.getId()); loadscanEntity.setWarehouseId(myCurrentWarehouse.getId());
loadscanEntity.setWarehouseName(myCurrentWarehouse.getName());
loadscanEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId()); loadscanEntity.setPackageId(parcelListEntity.getId());
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode());
loadscanEntity.setScanTime(now); loadscanEntity.setPackageNub(parcelListEntity.getQuantity());
BladeUser user = AuthUtil.getUser(); DistributionReservationEntity reservationEntity = distributionDeliveryListMapper.selectReservationByPackageAndDeliveryId(parcelListEntity.getOrderPackageCode(), distrilbutionloadingscanDTO.getDeliveryId());
loadscanEntity.setReservationId(reservationEntity.getId());
loadscanEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId());
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId());
loadscanEntity.setScanTime(now);
BladeUser user = AuthUtil.getUser();
// loadscanEntity.setScanUser(user.getUserName()); // loadscanEntity.setScanUser(user.getUserName());
loadscanEntity.setScanUser(user.getNickName()); loadscanEntity.setScanUser(user.getNickName());
loadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId()); loadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId());
loadscanEntity.setIsAbnormalLoading(1); loadscanEntity.setIsAbnormalLoading(1);
loadscanEntity.setLoadedNub(parcelListEntity.getQuantity()); loadscanEntity.setLoadedNub(parcelListEntity.getQuantity());
distributionLoadscanService.save(loadscanEntity); distributionLoadscanService.save(loadscanEntity);
//更新包件装车状态 //更新包件装车状态
packageLockIds.add(loadscanEntity.getPackageId()); packageLockIds.add(loadscanEntity.getPackageId());
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
parcelListEntity.setOrderPackageGroundingStatus(OrderPackageGroundingStatusConstant.daishangjia.getValue()); parcelListEntity.setOrderPackageGroundingStatus(OrderPackageGroundingStatusConstant.daishangjia.getValue());
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yichuku.getValue()); parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yichuku.getValue());
distributionParcelListService.updateById(parcelListEntity); distributionParcelListService.updateById(parcelListEntity);
//更新装车时间 //更新装车时间
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//进行解托操作
Map<String,Object> info = new HashMap<>();
info.put("orderPackageCode",parcelListEntity.getOrderPackageCode());
info.put("warehouseId",myCurrentWarehouse.getId());
warehouseUpdownTypeClient.downPackageAndDelTrayAndIsUpdate(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId(),"扫描装车进行下架、解托",false);
Map<String, Object> map = new HashMap();
String distrilbutionloadingscanDTOJson = JSONObject.toJSONString(distrilbutionloadingscanDTO);
map.put("distrilbutionloadingscanDTO", distrilbutionloadingscanDTOJson);
String parcelListEntityJson = JSONObject.toJSONString(parcelListEntity);
map.put("parcelListEntity", parcelListEntityJson);
map.put("myCurrentWarehouseId", myCurrentWarehouse.getId());
String reservationEntityJson = JSONObject.toJSONString(reservationEntity);
map.put("reservationEntity", reservationEntityJson);
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",loadscanEntity.getOrderPackageCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",loadscanEntity.getReservationId());
jsonObject.put("type",1);
jsonObject.put("num",1);
jsonObject.put("remark","装车下架");
jsonObjects.add(jsonObject);
log.info(">>>>>>>>>>>>> 进入延迟队列处理包件相关信息状态");
rabbitTemplate.convertAndSend(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_EXCHANGE, RabbitConstant.ORDER_PACKAGE_STATUS_INFO_ROUTING, map, message -> {
message.getMessageProperties()
.setHeader("x-delay", 3000);
return message;
});
String content = "包件在"+myCurrentWarehouse.getName()+"由"+loadscanEntity.getScanUser()+"扫描装车,配送车次号:"+distributionDeliveryListEntity.getTrainNumber()+"预约任务号:"+reservationEntity.getReservationCode();
JSONObject trunklinePackageTrackLog= new JSONObject();
try {
trunklinePackageTrackLog.put("tenantId",loadscanEntity.getTenantId());
trunklinePackageTrackLog.put("createTime",loadscanEntity.getCreateTime());
trunklinePackageTrackLog.put("createUser",loadscanEntity.getCreateUser());
trunklinePackageTrackLog.put("updateUser",loadscanEntity.getUpdateUser());
trunklinePackageTrackLog.put("updateTime",loadscanEntity.getUpdateTime());
trunklinePackageTrackLog.put("isDeleted",loadscanEntity.getIsDeleted());
trunklinePackageTrackLog.put("status",loadscanEntity.getStatus());
trunklinePackageTrackLog.put("createDept",loadscanEntity.getCreateDept());
trunklinePackageTrackLog.put("orderPackageCode",loadscanEntity.getOrderPackageCode());
trunklinePackageTrackLog.put("warehouseId",myCurrentWarehouse.getId());
trunklinePackageTrackLog.put("warehouseName",myCurrentWarehouse.getName());
trunklinePackageTrackLog.put("workNode",WorkNodeEnums.DISTRIBUTION_LOADING.getCode());
trunklinePackageTrackLog.put("content",content);
trunklinePackageTrackLog.put("operator",loadscanEntity.getScanUser());
}catch (Exception e){
log.error("装车日志数据错误",e);
}
aaa.add(trunklinePackageTrackLog);
orderPackageCodes.add(loadscanEntity.getOrderPackageCode());
pushList.add(parcelListEntity); //更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//进行解托操作
Map<String,Object> info = new HashMap<>();
info.put("orderPackageCode",parcelListEntity.getOrderPackageCode());
info.put("warehouseId",myCurrentWarehouse.getId());
warehouseUpdownTypeClient.downPackageAndDelTrayAndIsUpdate(parcelListEntity.getOrderPackageCode(),myCurrentWarehouse.getId(),"扫描装车进行下架、解托",false);
Map<String, Object> map = new HashMap();
String distrilbutionloadingscanDTOJson = JSONObject.toJSONString(distrilbutionloadingscanDTO);
map.put("distrilbutionloadingscanDTO", distrilbutionloadingscanDTOJson);
String parcelListEntityJson = JSONObject.toJSONString(parcelListEntity);
map.put("parcelListEntity", parcelListEntityJson);
map.put("myCurrentWarehouseId", myCurrentWarehouse.getId());
String reservationEntityJson = JSONObject.toJSONString(reservationEntity);
map.put("reservationEntity", reservationEntityJson);
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",loadscanEntity.getOrderPackageCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",loadscanEntity.getReservationId());
jsonObject.put("type",1);
jsonObject.put("num",1);
jsonObject.put("remark","装车下架");
jsonObjects.add(jsonObject);
log.info(">>>>>>>>>>>>> 进入延迟队列处理包件相关信息状态");
rabbitTemplate.convertAndSend(RabbitConstant.ORDER_PACKAGE_STATUS_INFO_EXCHANGE, RabbitConstant.ORDER_PACKAGE_STATUS_INFO_ROUTING, map, message -> {
message.getMessageProperties()
.setHeader("x-delay", 3000);
return message;
});
JSONObject trunklinePackageTrackLog= new JSONObject();
try {
String content = "包件在"+myCurrentWarehouse.getName()+"由"+loadscanEntity.getScanUser()+"扫描装车,配送车次号:"+distributionDeliveryListEntity.getTrainNumber()+"预约任务号:"+reservationEntity.getReservationCode();
trunklinePackageTrackLog.put("tenantId",loadscanEntity.getTenantId());
trunklinePackageTrackLog.put("createTime",loadscanEntity.getCreateTime());
trunklinePackageTrackLog.put("createUser",loadscanEntity.getCreateUser());
trunklinePackageTrackLog.put("updateUser",loadscanEntity.getUpdateUser());
trunklinePackageTrackLog.put("updateTime",loadscanEntity.getUpdateTime());
trunklinePackageTrackLog.put("isDeleted",loadscanEntity.getIsDeleted());
trunklinePackageTrackLog.put("status",loadscanEntity.getStatus());
trunklinePackageTrackLog.put("createDept",loadscanEntity.getCreateDept());
trunklinePackageTrackLog.put("orderPackageCode",loadscanEntity.getOrderPackageCode());
trunklinePackageTrackLog.put("warehouseId",myCurrentWarehouse.getId());
trunklinePackageTrackLog.put("warehouseName",myCurrentWarehouse.getName());
trunklinePackageTrackLog.put("workNode",WorkNodeEnums.DISTRIBUTION_LOADING.getCode());
trunklinePackageTrackLog.put("content",content);
trunklinePackageTrackLog.put("operator",loadscanEntity.getScanUser());
}catch (Exception e){
log.error("装车日志数据错误",e);
}
aaa.add(trunklinePackageTrackLog);
orderPackageCodes.add(loadscanEntity.getOrderPackageCode());
pushList.add(parcelListEntity);
//extracteOrderPackageStatus(distrilbutionloadingscanDTO, parcelListEntity, myCurrentWarehouse, reservationEntity);
//extracteOrderPackageStatus(distrilbutionloadingscanDTO, parcelListEntity, myCurrentWarehouse, reservationEntity);
} else if (parcelListEntityList.isEmpty()) {
//查找出该包件信息
DistributionParcelListEntity parcelListEntity = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()).eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()));
List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
boolean shangpeiFlag = reservationEntityList.stream().allMatch(r -> r.getDeliveryType().equals(DistributionTypeConstant.shipie.getValue()));
if (Func.isEmpty(parcelListEntity)) {
return Resp.scanFail("无包件信息", "无包件信息");
}
DistributionStockArticleEntity stockArticleEntity = distributionStockArticleMapper.selectById(parcelListEntity.getStockArticleId());
if (shangpeiFlag) {
List<DistributionReservationEntity> 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());
//查看是否存在满足条件的预约单
//存在多个,操作人指定具体客户即可
if (!reservationEntities.isEmpty()) {
if (Func.isEmpty(distrilbutionloadingscanDTO.getReservationId())) {
log.info("异常装车未指定客户");
return Resp.scanFail("请指定客户进行异常装车", "请指定客户进行异常装车");
}
return R.fail(5000, "异常装车");
// return Resp.scanFail("装车失败","程序出错,请联系彪桑");
} else {
if (parcelListEntity.getConditions() == 2) {
return Resp.scanFail("此包件不是订制品", "此包件不是订制品");
} else { } else if (parcelListEntityList.isEmpty()) {
return Resp.scanFail("窜货", "窜货"); //查找出该包件信息
} DistributionParcelListEntity parcelListEntity = distributionParcelListService.getOne(Wrappers.<DistributionParcelListEntity>query().lambda().eq(DistributionParcelListEntity::getOrderPackageCode, distrilbutionloadingscanDTO.getBarcode()).eq(DistributionParcelListEntity::getWarehouseId, myCurrentWarehouse.getId()));
List<DistributionReservationEntity> reservationEntityList = distributionDeliveryListMapper.selectReservationByDeliveryListId(distrilbutionloadingscanDTO.getDeliveryId());
boolean shangpeiFlag = reservationEntityList.stream().allMatch(r -> r.getDeliveryType().equals(DistributionTypeConstant.shipie.getValue()));
if (Func.isEmpty(parcelListEntity)) {
return Resp.scanFail("无包件信息", "无包件信息");
} }
} else { DistributionStockArticleEntity stockArticleEntity = distributionStockArticleMapper.selectById(parcelListEntity.getStockArticleId());
shangpeiFlag = reservationEntityList.stream().allMatch(r -> r.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue()));
if (shangpeiFlag) { if (shangpeiFlag) {
List<DistributionReservationEntity> reservationEntities = reservationEntityList.stream().filter(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName())).collect(Collectors.toList()); List<DistributionReservationEntity> 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());
//查询是否满足商配异常装车 //查看是否存在满足条件的预约单
boolean flag = reservationEntityList.stream().anyMatch(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName())); //存在多个,操作人指定具体客户即可
if (reservationEntities.size() == 1) { if (!reservationEntities.isEmpty()) {
if (Func.isEmpty(distrilbutionloadingscanDTO.getReservationId())) { if (Func.isEmpty(distrilbutionloadingscanDTO.getReservationId())) {
log.info("异常装车未指定客户"); log.info("异常装车未指定客户");
return Resp.scanFail("请指定客户进行异常装车", "请指定客户进行异常装车"); return Resp.scanFail("请指定客户进行异常装车", "请指定客户进行异常装车");
} }
return R.fail(5000, "异常装车"); return R.fail(5000, "异常装车");
// return Resp.scanFail("装车失败","程序出错,请联系彪桑");
} else { } else {
return Resp.scanFail("窜货", "窜货"); if (parcelListEntity.getConditions() == 2) {
return Resp.scanFail("此包件不是订制品", "此包件不是订制品");
} else {
return Resp.scanFail("窜货", "窜货");
}
} }
} else { } else {
log.error("配送计划预约类型错误:{}", reservationEntityList);
shangpeiFlag = reservationEntityList.stream().allMatch(r -> r.getDeliveryType().equals(DistributionTypeConstant.shangpei.getValue()));
if (shangpeiFlag) {
List<DistributionReservationEntity> reservationEntities = reservationEntityList.stream().filter(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName())).collect(Collectors.toList());
//查询是否满足商配异常装车
boolean flag = reservationEntityList.stream().anyMatch(r -> r.getReceivingUnit().equals(stockArticleEntity.getConsigneeUnit()) && r.getMallName().equals(stockArticleEntity.getMallName()));
if (reservationEntities.size() == 1) {
if (Func.isEmpty(distrilbutionloadingscanDTO.getReservationId())) {
log.info("异常装车未指定客户");
return Resp.scanFail("请指定客户进行异常装车", "请指定客户进行异常装车");
}
return R.fail(5000, "异常装车");
} else {
return Resp.scanFail("窜货", "窜货");
}
} else {
log.error("配送计划预约类型错误:{}", reservationEntityList);
}
} }
log.info("异常装车判定成功>>>>>>packageCode:{},reservationId:{}",distrilbutionloadingscanDTO.getBarcode(),distrilbutionloadingscanDTO.getReservationId());
} }
log.info("异常装车判定成功>>>>>>packageCode:{},reservationId:{}",distrilbutionloadingscanDTO.getBarcode(),distrilbutionloadingscanDTO.getReservationId()); } else if (distrilbutionloadingscanDTO.getType() == 2) {
} log.info("#########!!!!!!!!!!!!!!!!!--------- 000000000 type={}", distrilbutionloadingscanDTO.getType());
} else if (distrilbutionloadingscanDTO.getType() == 2) { TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeClient.selectListByTrayCode(distrilbutionloadingscanDTO.getBarcode());
log.info("#########!!!!!!!!!!!!!!!!!--------- 000000000 type={}", distrilbutionloadingscanDTO.getType()); if (Func.isNotEmpty(trayTypeDataVO)) {
TrayTypeDataVO trayTypeDataVO = warehouseTrayTypeClient.selectListByTrayCode(distrilbutionloadingscanDTO.getBarcode()); List<WarehouseTrayGoodsEntity> voGoodsLsit = trayTypeDataVO.getGoodsLsit();
if (Func.isNotEmpty(trayTypeDataVO)) { boolean isAllProducts = voGoodsLsit.stream().allMatch(t -> "3".equals(t.getAssociationType()));
List<WarehouseTrayGoodsEntity> voGoodsLsit = trayTypeDataVO.getGoodsLsit(); if (isAllProducts) {
boolean isAllProducts = voGoodsLsit.stream().allMatch(t -> "3".equals(t.getAssociationType())); //该托盘商全部都是订制品
if (isAllProducts) { List<Long> trayGoodIds = voGoodsLsit.stream().filter(v -> "3".equals(v.getAssociationType())).map(WarehouseTrayGoodsEntity::getAssociationId).collect(Collectors.toList());
//该托盘商全部都是订制品 List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.listByIds(trayGoodIds);
List<Long> trayGoodIds = voGoodsLsit.stream().filter(v -> "3".equals(v.getAssociationType())).map(WarehouseTrayGoodsEntity::getAssociationId).collect(Collectors.toList()); if (trayGoodIds.size() != parcelListEntities.size()) {
List<DistributionParcelListEntity> parcelListEntities = distributionParcelListService.listByIds(trayGoodIds); return Resp.scanFail("托盘存在其他货物", "托盘存在其他货物");
if (trayGoodIds.size() != parcelListEntities.size()) {
return Resp.scanFail("托盘存在其他货物", "托盘存在其他货物");
}
//判断该货物都属于同一客户才能进行装车
List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
boolean isBelongToReservation = parcelListEntities.stream().allMatch(tp -> parcelListEntityList.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()).contains(tp.getId()));
log.info("#########!!!!!!!!!!!!!!!!!--------- 111111111 isBelongToReservation={}", isBelongToReservation);
if (isBelongToReservation) {
log.info("#########!!!!!!!!!!!!!!!!!--------- 222222222");
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()).ne(DistributionLoadscanEntity::getScanStatus, 1).eq(DistributionLoadscanEntity::getTrayNo, distrilbutionloadingscanDTO.getBarcode()));
boolean trayLoadingStatus = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
log.info("#########!!!!!!!!!!!!!!!!!--------- 333333333 trayLoadingStatus={} loadscanEntityList={}", trayLoadingStatus, loadscanEntityList);
if (Func.isNotEmpty(loadscanEntityList) && !loadscanEntityList.isEmpty() && trayLoadingStatus) {
return Resp.scanFail("重复扫描", "重复扫描");
}
log.info("#########!!!!!!!!!!!!!!!!!--------- 444444444 parcelListEntities={}", parcelListEntities);
if (Func.isEmpty(parcelListEntities) || parcelListEntities.size() <= 0) {
return Resp.scanFail("该托盘上无货物信息", "该托盘上无货物信息");
} }
//判断该货物都属于同一客户才能进行装车
List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
boolean isBelongToReservation = parcelListEntities.stream().allMatch(tp -> parcelListEntityList.stream().map(DistributionParcelListEntity::getId).collect(Collectors.toList()).contains(tp.getId()));
log.info("#########!!!!!!!!!!!!!!!!!--------- 111111111 isBelongToReservation={}", isBelongToReservation);
if (isBelongToReservation) {
log.info("#########!!!!!!!!!!!!!!!!!--------- 222222222");
List<DistributionLoadscanEntity> loadscanEntityList = distributionLoadscanService.list(Wrappers.<DistributionLoadscanEntity>query().lambda().eq(DistributionLoadscanEntity::getDeliveryId, distrilbutionloadingscanDTO.getDeliveryId()).ne(DistributionLoadscanEntity::getScanStatus, 1).eq(DistributionLoadscanEntity::getTrayNo, distrilbutionloadingscanDTO.getBarcode()));
boolean trayLoadingStatus = parcelListEntities.stream().allMatch(p -> p.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.yizhuangche.getValue()));
log.info("#########!!!!!!!!!!!!!!!!!--------- 333333333 trayLoadingStatus={} loadscanEntityList={}", trayLoadingStatus, loadscanEntityList);
if (Func.isNotEmpty(loadscanEntityList) && !loadscanEntityList.isEmpty() && trayLoadingStatus) {
return Resp.scanFail("重复扫描", "重复扫描");
}
log.info("#########!!!!!!!!!!!!!!!!!--------- 444444444 parcelListEntities={}", parcelListEntities);
if (Func.isEmpty(parcelListEntities) || parcelListEntities.size() <= 0) {
return Resp.scanFail("该托盘上无货物信息", "该托盘上无货物信息");
}
log.info("#########!!!!!!!!!!!!!!!!!--------- 55555555555 distrilbutionloadingscanDTO={}", distrilbutionloadingscanDTO); log.info("#########!!!!!!!!!!!!!!!!!--------- 55555555555 distrilbutionloadingscanDTO={}", distrilbutionloadingscanDTO);
if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())) { if (Func.isNotEmpty(distrilbutionloadingscanDTO.getReservationId())) {
//存在客户 这里就是针对客户进行的整托装车 //存在客户 这里就是针对客户进行的整托装车
// List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId()); // List<DistributionParcelListEntity> parcelListEntityList = distributionReservationMapper.selectPackageListByReservationId(distrilbutionloadingscanDTO.getReservationId());
Map<Long, DistributionParcelListEntity> parcelListEntityMap = parcelListEntityList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getId, Function.identity(), (k1, k2) -> k2)); Map<Long, DistributionParcelListEntity> parcelListEntityMap = parcelListEntityList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getId, Function.identity(), (k1, k2) -> k2));
boolean reservationFlag = parcelListEntities.stream().allMatch(p -> Func.isNotEmpty(parcelListEntityMap.get(p.getId()))); boolean reservationFlag = parcelListEntities.stream().allMatch(p -> Func.isNotEmpty(parcelListEntityMap.get(p.getId())));
log.info("#########!!!!!!!!!!!!!!!!!--------- 6666666666 reservationFlag={}", reservationFlag); log.info("#########!!!!!!!!!!!!!!!!!--------- 6666666666 reservationFlag={}", reservationFlag);
if (reservationFlag) { if (reservationFlag) {
try { try {
warehouseUpdownTypeClient.downTray(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId()); warehouseUpdownTypeClient.downTray(distrilbutionloadingscanDTO.getBarcode(), myCurrentWarehouse.getId());
} catch (Exception e) { } catch (Exception e) {
log.error("#################货物下架错误:{}", distrilbutionloadingscanDTO.getBarcode()); log.error("#################货物下架错误:{}", distrilbutionloadingscanDTO.getBarcode());
// return Resp.scanFail("装车失败", "装车失败"); // return Resp.scanFail("装车失败", "装车失败");
} }
DistributionReservationEntity reservationEntity = distributionReservationService.getById(distrilbutionloadingscanDTO.getReservationId()); DistributionReservationEntity reservationEntity = distributionReservationService.getById(distrilbutionloadingscanDTO.getReservationId());
List<DistributionLoadscanEntity> reservationLoadscanEntities = new ArrayList<>(); List<DistributionLoadscanEntity> reservationLoadscanEntities = new ArrayList<>();
List<String> orderCodes = new ArrayList<>(); List<String> orderCodes = new ArrayList<>();
for (DistributionParcelListEntity parcelListEntity : parcelListEntities) { for (DistributionParcelListEntity parcelListEntity : parcelListEntities) {
log.info("#########!!!!!!!!!!!!!!!!!--------- 88888888888 parcelListEntities={}", parcelListEntities); log.info("#########!!!!!!!!!!!!!!!!!--------- 88888888888 parcelListEntities={}", parcelListEntities);
if (parcelListEntity.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())) { if (parcelListEntity.getOrderPackageLoadingStatus().equals(OrderPackageLoadingStatusConstant.weizhuancghe.getValue())) {
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yichuku.getValue()); parcelListEntity.setOrderPackageStatus(OrderPackageStatusConstant.yichuku.getValue());
distributionParcelListService.updateById(parcelListEntity); distributionParcelListService.updateById(parcelListEntity);
DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity(); DistributionLoadscanEntity loadscanEntity = new DistributionLoadscanEntity();
log.info("#########!!!!!!!!!!!!!!!!!--------- 77777777777 distributionDeliverySelfEntity={}", distributionDeliverySelfEntity); log.info("#########!!!!!!!!!!!!!!!!!--------- 77777777777 distributionDeliverySelfEntity={}", distributionDeliverySelfEntity);
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDeliveryId())) { if (Func.isNotEmpty(distributionDeliverySelfEntity.getDeliveryId())) {
loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId()); loadscanEntity.setDriverId(distributionDeliverySelfEntity.getDriverId());
} }
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) { if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverName())) {
loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName()); loadscanEntity.setDriverName(distributionDeliverySelfEntity.getDriverName());
} }
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) { if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleNub())) {
loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub()); loadscanEntity.setVehicleName(distributionDeliverySelfEntity.getVehicleNub());
} }
if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) { if (Func.isNotEmpty(distributionDeliverySelfEntity.getVehicleId())) {
loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId()); loadscanEntity.setVehicleId(distributionDeliverySelfEntity.getVehicleId());
} }
if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) { if (Func.isNotEmpty(distributionDeliverySelfEntity.getDriverPhone())) {
loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone()); loadscanEntity.setDriverPhone(distributionDeliverySelfEntity.getDriverPhone());
} }
loadscanEntity.setScanTime(now); loadscanEntity.setScanTime(now);
loadscanEntity.setOrderId(parcelListEntity.getStockArticleId()); loadscanEntity.setOrderId(parcelListEntity.getStockArticleId());
loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode()); loadscanEntity.setOrderPackageCode(parcelListEntity.getOrderPackageCode());
loadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId()); loadscanEntity.setReservationId(distrilbutionloadingscanDTO.getReservationId());
loadscanEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId()); loadscanEntity.setDeliveryId(distrilbutionloadingscanDTO.getDeliveryId());
loadscanEntity.setTrainNumber(distributionDeliveryListEntity.getTrainNumber()); loadscanEntity.setTrainNumber(distributionDeliveryListEntity.getTrainNumber());
loadscanEntity.setPackageNub(parcelListEntity.getQuantity()); loadscanEntity.setPackageNub(parcelListEntity.getQuantity());
loadscanEntity.setPackageId(parcelListEntity.getId()); loadscanEntity.setPackageId(parcelListEntity.getId());
BladeUser user = AuthUtil.getUser(); BladeUser user = AuthUtil.getUser();
// loadscanEntity.setScanUser(user.getUserName()); // loadscanEntity.setScanUser(user.getUserName());
loadscanEntity.setScanUser(user.getNickName()); loadscanEntity.setScanUser(user.getNickName());
loadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId()); loadscanEntity.setLoadingId(distrilbutionloadingscanDTO.getLoadingId());
loadscanEntity.setOneClick(1); loadscanEntity.setOneClick(1);
loadscanEntity.setScanType("2"); loadscanEntity.setScanType("2");
loadscanEntity.setScanStatus("2"); loadscanEntity.setScanStatus("2");
loadscanEntity.setIsInsert(1); loadscanEntity.setIsInsert(1);
loadscanEntity.setMsg("司机整托装车"); loadscanEntity.setMsg("司机整托装车");
loadscanEntity.setTrayNo(trayTypeDataVO.getTrayCode()); loadscanEntity.setTrayNo(trayTypeDataVO.getTrayCode());
reservationLoadscanEntities.add(loadscanEntity); reservationLoadscanEntities.add(loadscanEntity);
Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId()); Integer i = distributionDeliveryListMapper.updateloadingTimeById(distrilbutionloadingscanDTO.getDeliveryId());
//更新签收表的装车数量 //更新签收表的装车数量
Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub()); Integer j = distributionSignforMapper.updateloadByReservationId(loadscanEntity.getDeliveryId(), loadscanEntity.getReservationId(), loadscanEntity.getPackageNub());
//扣减订单的在库数量 //扣减订单的在库数量
orderCodes.add(parcelListEntity.getOrderCode()); orderCodes.add(parcelListEntity.getOrderCode());
//修改包件为装车状态 //修改包件为装车状态
orderPackageCodes.add(parcelListEntity.getOrderPackageCode()); orderPackageCodes.add(parcelListEntity.getOrderPackageCode());
parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue()); parcelListEntity.setOrderPackageLoadingStatus(OrderPackageLoadingStatusConstant.yizhuangche.getValue());
distributionParcelListService.updateById(parcelListEntity); distributionParcelListService.updateById(parcelListEntity);
packageLockIds.add(loadscanEntity.getPackageId()); packageLockIds.add(loadscanEntity.getPackageId());
String content = "包件在"+myCurrentWarehouse.getName()+"由"+loadscanEntity.getScanUser()+"扫描托盘:"+loadscanEntity.getTrayNo()+"装车,配送车次号:"+distributionDeliveryListEntity.getTrainNumber()+"预约任务号:"+reservationEntity.getReservationCode(); String content = "包件在"+myCurrentWarehouse.getName()+"由"+loadscanEntity.getScanUser()+"扫描托盘:"+loadscanEntity.getTrayNo()+"装车,配送车次号:"+distributionDeliveryListEntity.getTrainNumber()+"预约任务号:"+reservationEntity.getReservationCode();
JSONObject trunklinePackageTrackLog= new JSONObject(); JSONObject trunklinePackageTrackLog= new JSONObject();
trunklinePackageTrackLog.put("tenantId",loadscanEntity.getTenantId()); trunklinePackageTrackLog.put("tenantId",loadscanEntity.getTenantId());
trunklinePackageTrackLog.put("createTime",loadscanEntity.getCreateTime()); trunklinePackageTrackLog.put("createTime",loadscanEntity.getCreateTime());
trunklinePackageTrackLog.put("createUser",loadscanEntity.getCreateUser()); trunklinePackageTrackLog.put("createUser",loadscanEntity.getCreateUser());
trunklinePackageTrackLog.put("updateUser",loadscanEntity.getUpdateUser()); trunklinePackageTrackLog.put("updateUser",loadscanEntity.getUpdateUser());
trunklinePackageTrackLog.put("updateTime",loadscanEntity.getUpdateTime()); trunklinePackageTrackLog.put("updateTime",loadscanEntity.getUpdateTime());
trunklinePackageTrackLog.put("isDeleted",loadscanEntity.getIsDeleted()); trunklinePackageTrackLog.put("isDeleted",loadscanEntity.getIsDeleted());
trunklinePackageTrackLog.put("status",loadscanEntity.getStatus()); trunklinePackageTrackLog.put("status",loadscanEntity.getStatus());
trunklinePackageTrackLog.put("createDept",loadscanEntity.getCreateDept()); trunklinePackageTrackLog.put("createDept",loadscanEntity.getCreateDept());
trunklinePackageTrackLog.put("orderPackageCode",loadscanEntity.getOrderPackageCode()); trunklinePackageTrackLog.put("orderPackageCode",loadscanEntity.getOrderPackageCode());
trunklinePackageTrackLog.put("warehouseId",loadscanEntity.getWarehouseId()==null?myCurrentWarehouse.getId():loadscanEntity.getWarehouseId()); trunklinePackageTrackLog.put("warehouseId",loadscanEntity.getWarehouseId()==null?myCurrentWarehouse.getId():loadscanEntity.getWarehouseId());
trunklinePackageTrackLog.put("warehouseName",loadscanEntity.getWarehouseName()==null?myCurrentWarehouse.getName():loadscanEntity.getWarehouseName()); trunklinePackageTrackLog.put("warehouseName",loadscanEntity.getWarehouseName()==null?myCurrentWarehouse.getName():loadscanEntity.getWarehouseName());
trunklinePackageTrackLog.put("workNode",WorkNodeEnums.DISTRIBUTION_LOADING.getCode()); trunklinePackageTrackLog.put("workNode",WorkNodeEnums.DISTRIBUTION_LOADING.getCode());
trunklinePackageTrackLog.put("content",content); trunklinePackageTrackLog.put("content",content);
trunklinePackageTrackLog.put("operator",loadscanEntity.getScanUser()); trunklinePackageTrackLog.put("operator",loadscanEntity.getScanUser());
aaa.add(trunklinePackageTrackLog); aaa.add(trunklinePackageTrackLog);
orderPackageCodes.add(loadscanEntity.getOrderPackageCode()); orderPackageCodes.add(loadscanEntity.getOrderPackageCode());
pushList.add(parcelListEntity); pushList.add(parcelListEntity);
}
} }
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",trayTypeDataVO.getTrayCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distrilbutionloadingscanDTO.getReservationId());
jsonObject.put("type",1);
jsonObject.put("num",1);
jsonObject.put("remark","装车下架");
jsonObjects.add(jsonObject);
distributionLoadscanService.saveBatch(reservationLoadscanEntities);
//这里则进行整托装车的数据构建
//维护订单的信息
if (Func.isNotEmpty(orderCodes)) {
String orderCode = orderCodes.stream().distinct().collect(Collectors.joining(","));
distributionStockArticleService.maintenanceOrderInfo(orderCode, myCurrentWarehouse.getId());
}
if (Func.isNotEmpty(orderPackageCodes)) {
String orderPackages = orderPackageCodes.stream().distinct().collect(Collectors.joining(","));
Map<String,Object> map = new HashMap<>();
map.put("orderPackageCode",orderPackages);
map.put("warehouseId",myCurrentWarehouse.getId());
warehouseUpdownTypeClient.downDeliveryPackage(map);
}
//维护预约的信息
distributionReservationService.maintenanceReservationInfo(distrilbutionloadingscanDTO.getReservationId());
//维护配送任务信息
distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId());
} else {
log.info("#########!!!!!!!!!!!!!!!!!--------- 101010101010 存在其他客户货物");
return Resp.scanFail("整托装车失败", "存在其他客户货物");
} }
JSONObject jsonObject = new JSONObject();
jsonObject.put("code",trayTypeDataVO.getTrayCode());
jsonObject.put("warehouseId",myCurrentWarehouse.getId());
jsonObject.put("taskId",distrilbutionloadingscanDTO.getReservationId());
jsonObject.put("type",1);
jsonObject.put("num",1);
jsonObject.put("remark","装车下架");
jsonObjects.add(jsonObject);
distributionLoadscanService.saveBatch(reservationLoadscanEntities);
//这里则进行整托装车的数据构建
//维护订单的信息
if (Func.isNotEmpty(orderCodes)) {
String orderCode = orderCodes.stream().distinct().collect(Collectors.joining(","));
distributionStockArticleService.maintenanceOrderInfo(orderCode, myCurrentWarehouse.getId());
}
if (Func.isNotEmpty(orderPackageCodes)) {
String orderPackages = orderPackageCodes.stream().distinct().collect(Collectors.joining(","));
Map<String,Object> map = new HashMap<>();
map.put("orderPackageCode",orderPackages);
map.put("warehouseId",myCurrentWarehouse.getId());
warehouseUpdownTypeClient.downDeliveryPackage(map);
}
//维护预约的信息
distributionReservationService.maintenanceReservationInfo(distrilbutionloadingscanDTO.getReservationId());
//维护配送任务信息
distributionDeliveryListService.maintenanceDeliveryInfo(distrilbutionloadingscanDTO.getDeliveryId());
} else {
log.info("#########!!!!!!!!!!!!!!!!!--------- 101010101010 存在其他客户货物");
return Resp.scanFail("整托装车失败", "存在其他客户货物");
} }
} else {
log.info("#########!!!!!!!!!!!!!!!!!--------- 101010101010 存在其他客户货物");
return Resp.scanFail("整托装车失败", "存在其他客户货物");
} }
} else {
log.info("#########!!!!!!!!!!!!!!!!!--------- 101010101010 存在其他客户货物");
return Resp.scanFail("整托装车失败", "存在其他客户货物");
} }
} else {
log.info("#########!!!!!!!!!!!!!!!!!--------- 101010101010 查询托盘货物失败");
return Resp.scanFail("查询托盘货物失败", "查询托盘货物失败");
} }
} else { }
log.info("#########!!!!!!!!!!!!!!!!!--------- 101010101010 查询托盘货物失败"); if(CollUtil.isNotEmpty(pushList)){
return Resp.scanFail("查询托盘货物失败", "查询托盘货物失败"); for (DistributionParcelListEntity parcelListEntity : pushList) {
} List<Object> contents = new ArrayList<>();
} PushData pushData = PushData.builder()
if(CollUtil.isNotEmpty(pushList)){ .packageCode(parcelListEntity.getOrderPackageCode())
for (DistributionParcelListEntity parcelListEntity : pushList) { .orderCode(parcelListEntity.getOrderCode())
List<Object> contents = new ArrayList<>(); .warehouseName(myCurrentWarehouse.getName())
PushData pushData = PushData.builder() .waybillNumber(parcelListEntity.getWaybillNumber()).build();
.packageCode(parcelListEntity.getOrderPackageCode()) contents.add(pushData);
.orderCode(parcelListEntity.getOrderCode()) NodePushMsg msg = new NodePushMsg();
.warehouseName(myCurrentWarehouse.getName()) msg.setNode(WorkNodeEnums.DISTRIBUTION_LOADING);
.waybillNumber(parcelListEntity.getWaybillNumber()).build(); msg.setBrand(BrandEnums.getByValue(parcelListEntity.getBrandName()));
contents.add(pushData); msg.setOperator(AuthUtil.getNickName());
NodePushMsg msg = new NodePushMsg(); msg.setOperatorTime(new Date());
msg.setNode(WorkNodeEnums.DISTRIBUTION_LOADING); msg.setContent(contents);
msg.setBrand(BrandEnums.getByValue(parcelListEntity.getBrandName())); log.info("推送工厂数据:{}", JSONUtil.toJsonStr(msg));
msg.setOperator(AuthUtil.getNickName()); factoryDataMessageSender.sendNodeDataByBrand(msg);
msg.setOperatorTime(new Date()); }
msg.setContent(contents); }
log.info("推送工厂数据:{}", JSONUtil.toJsonStr(msg)); //添加缓存
factoryDataMessageSender.sendNodeDataByBrand(msg); if (!packageLockIds.isEmpty()){
} List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:");
} if (Func.isNotEmpty(a)){
//添加缓存 boolean flag = a.stream().anyMatch(any -> packageLockIds.contains(any));
if (!packageLockIds.isEmpty()){ if (flag){
List<Long> a = bladeRedis.get("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:"); //正在操作,请稍后重试
if (Func.isNotEmpty(a)){ throw new RuntimeException("该包件正在被操作,请稍后再试!!!");
boolean flag = a.stream().anyMatch(any -> packageLockIds.contains(any)); }else {
if (flag){ packageLockIds.addAll(a);
//正在操作,请稍后重试 bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:",packageLockIds,60L);
throw new RuntimeException("该包件正在被操作,请稍后再试!!!"); }
}else { }else {
packageLockIds.addAll(a); bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:" ,packageLockIds,60L);
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:",packageLockIds,60L);
} }
}else {
bladeRedis.setEx("warehouseId:" + myCurrentWarehouse.getId() + "trainNumber:" + distributionDeliveryListEntity.getTrainNumber() + "orderPackageCode:" ,packageLockIds,60L);
} }
} //备货库位下架
//备货库位下架 log.info("备货库位下架>>>>>>>>>>>>>>>>>>>>>>jsonObjects:{}",jsonObjects);
log.info("备货库位下架>>>>>>>>>>>>>>>>>>>>>>jsonObjects:{}",jsonObjects); warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects);
warehouseUpdownStockUpAreaClient.downStockUpShelf(jsonObjects); //查询已装车件数
//查询已装车件数
// String str = getLoadingMsg(distrilbutionloadingscanDTO); // String str = getLoadingMsg(distrilbutionloadingscanDTO);
trunklinePackageTrackLogClient.addPackageTrackLog(aaa); trunklinePackageTrackLogClient.addPackageTrackLog(aaa);
Integer carLaodNum = getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId());
return Resp.scanSuccessWithData("装车成功", carLaodNum + "件", carLaodNum);
}catch (Exception e){
log.error("装车扫码错误",e);
throw new CustomerException(e.getMessage());
}
Integer carLaodNum = getCarLaodNum(distrilbutionloadingscanDTO.getDeliveryId());
return Resp.scanSuccessWithData("装车成功", carLaodNum + "件", carLaodNum);
} }
private void extracteOrderPackageStatus(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, DistributionParcelListEntity parcelListEntity, BasicdataWarehouseEntity myCurrentWarehouse, DistributionReservationEntity reservationEntity) { private void extracteOrderPackageStatus(DistrilbutionloadingscanDTO distrilbutionloadingscanDTO, DistributionParcelListEntity parcelListEntity, BasicdataWarehouseEntity myCurrentWarehouse, DistributionReservationEntity reservationEntity) {

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionParcelListServiceImpl.java

@ -1286,4 +1286,9 @@ public class DistributionParcelListServiceImpl extends BaseServiceImpl<Distribut
return resultMap; return resultMap;
} }
@Override
public List<DistributionParcelListEntity> findALLNoUpShelfPackageByOrderCodeList(List<String> orderCodeList, Long warehouseId) {
return baseMapper.findALLNoUpShelfPackageByOrderCodeList(orderCodeList,warehouseId);
}
} }

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.java

@ -94,4 +94,6 @@ public interface WarehouseTrayGoodsMapper extends BaseMapper<WarehouseTrayGoodsE
* @return * @return
*/ */
List<WarehouseTrayGoodsEntity> getPackageTrayInfo(@Param("param")Map<String, Object> map); List<WarehouseTrayGoodsEntity> getPackageTrayInfo(@Param("param")Map<String, Object> map);
void deleteEntityByTrayGoodsIds(@Param("trayGoodsIds") List<Long> trayGoodsIds);
} }

8
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseTrayGoodsMapper.xml

@ -442,4 +442,12 @@
</select> </select>
<delete id="deleteEntityByTrayGoodsIds" >
delete from logpm_warehouse_tray_goods
WHERE id in
<foreach collection="trayGoodsIds" item="item" index="index" open="(" close=")" separator=",">
#{item}
</foreach>
</delete>
</mapper> </mapper>

5
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.java

@ -133,6 +133,11 @@ public interface WarehouseUpdownGoodsMapper extends BaseMapper<WarehouseUpdownGo
List<DistributionParcelListEntity> findParcelListByAllocationIdAndWarehouseId(@Param("allocationId") String allocationId, @Param("warehouseId") Long warehouseId); List<DistributionParcelListEntity> findParcelListByAllocationIdAndWarehouseId(@Param("allocationId") String allocationId, @Param("warehouseId") Long warehouseId);
List<String> findOrderPackageCodesByOrderPackageCodeList(@Param("orderPackageCodeList") List<String> orderPackageCodeList, @Param("warehouseId") Long warehouseId);
void deleteByUpdownGoodsIds(@Param("updownGoodsIds") List<Long> updownGoodsIds);
// /** // /**
// * 根据货位查询货物 // * 根据货位查询货物
// * // *

18
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/mapper/WarehouseUpdownGoodsMapper.xml

@ -537,4 +537,22 @@
and ldpl.warehouse_id = #{warehouseId} and ldpl.warehouse_id = #{warehouseId}
</select> </select>
<select id="findOrderPackageCodesByOrderPackageCodeList" resultType="String">
select association_value
from logpm_warehouse_updown_goods
where association_type = '3'
and association_value in
<foreach collection="orderPackageCodeList" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
<delete id="deleteByUpdownGoodsIds">
delete from logpm_warehouse_updown_goods
where id in
<foreach collection="updownGoodsIds" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</delete>
</mapper> </mapper>

2
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayGoodsService.java

@ -29,6 +29,8 @@ public interface IWarehouseTrayGoodsService extends BaseService<WarehouseTrayGoo
Integer deleteByTrayGoodsId(Long trayGoodsId,Long warehouseId); Integer deleteByTrayGoodsId(Long trayGoodsId,Long warehouseId);
Integer deleteByTrayGoodsIds(List<Long> trayGoodsIds, Long trayTypeId,Long warehouseId);
Boolean downZeroByTrayId(Long trayGoodsId,Long orderId,Long warehouseId,Integer num,String remark); Boolean downZeroByTrayId(Long trayGoodsId,Long orderId,Long warehouseId,Integer num,String remark);
List<TrayTypeDataListVO> getZeroListByTrayTypeId(Long trayTypeId,Long warehouseId); List<TrayTypeDataListVO> getZeroListByTrayTypeId(Long trayTypeId,Long warehouseId);

5
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseTrayTypeService.java

@ -2,6 +2,7 @@ package com.logpm.warehouse.service;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.warehouse.dto.TrayTypeDTO; import com.logpm.warehouse.dto.TrayTypeDTO;
import com.logpm.warehouse.dto.ZeroOrderVO; import com.logpm.warehouse.dto.ZeroOrderVO;
import com.logpm.warehouse.entity.WarehouseTrayTypeEntity; import com.logpm.warehouse.entity.WarehouseTrayTypeEntity;
@ -57,6 +58,8 @@ public interface IWarehouseTrayTypeService extends BaseService<WarehouseTrayType
void downPackageByOrderPackageCode(String orderPackageCode,String remark,Long warehouseId); void downPackageByOrderPackageCode(String orderPackageCode,String remark,Long warehouseId);
void downPackageByOrderPackageCodeList(List<String> orderPackageCodeList,String remark,Long warehouseId);
void updateEntityNumByTrayGoodsIdAndNumStock(Long trayGoodsId, Integer enterNum,String remark); void updateEntityNumByTrayGoodsIdAndNumStock(Long trayGoodsId, Integer enterNum,String remark);
void downTrayGoodsByTrayId(Long trayId,String remark); void downTrayGoodsByTrayId(Long trayId,String remark);
@ -113,4 +116,6 @@ public interface IWarehouseTrayTypeService extends BaseService<WarehouseTrayType
*/ */
Integer getZeroOrderByOrderId(Long orderId, Long warehouseId); Integer getZeroOrderByOrderId(Long orderId, Long warehouseId);
void orderScanOrderPackageCodeList(WarehouseTrayTypeEntity trayTypeEntity, List<DistributionParcelListEntity> parcelListEntityList, Long warehouseId, String remark);
} }

4
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownGoodsService.java

@ -76,6 +76,7 @@ public interface IWarehouseUpdownGoodsService extends BaseService<WarehouseUpdow
List<WarehouseUpdownGoodsEntity> findListByUpdownTypeIdAndOrderCode(Long updownTypeId, String orderCode); List<WarehouseUpdownGoodsEntity> findListByUpdownTypeIdAndOrderCode(Long updownTypeId, String orderCode);
void bindingAllocationAndPackage(WarehouseUpdownTypeEntity updownTypeEntity, DistributionParcelListEntity parcelListEntity, String bindingType,Integer isAlltrays,String remark); void bindingAllocationAndPackage(WarehouseUpdownTypeEntity updownTypeEntity, DistributionParcelListEntity parcelListEntity, String bindingType,Integer isAlltrays,String remark);
void bindingAllocationAndPackageList(WarehouseUpdownTypeEntity updownTypeEntity, List<DistributionParcelListEntity> parcelListEntities, String bindingType,Integer isAlltrays,String remark);
Map<String, Integer> getTotalNumberAndNum(Long updownTypeId); Map<String, Integer> getTotalNumberAndNum(Long updownTypeId);
@ -105,6 +106,7 @@ public interface IWarehouseUpdownGoodsService extends BaseService<WarehouseUpdow
Integer selectCountByArea(String ids); Integer selectCountByArea(String ids);
Integer deleteByUpdownGoodsId(Long updownGoodsId); Integer deleteByUpdownGoodsId(Long updownGoodsId);
Integer deleteByUpdownGoodsIds(List<Long> updownGoodsIds,Long updownTypeId);
void updeteNumByUpdownGoodsId(int num, Long updownGoodsId); void updeteNumByUpdownGoodsId(int num, Long updownGoodsId);
@ -154,4 +156,6 @@ public interface IWarehouseUpdownGoodsService extends BaseService<WarehouseUpdow
List<String> getAllocationsByOrderPackages(List<String> orderPackageOrders, Long warehouseId); List<String> getAllocationsByOrderPackages(List<String> orderPackageOrders, Long warehouseId);
List<String> getAllocationsByWarehouseIdAndMarketIdAndSku(Long mallId, String sku, Long warehouseId); List<String> getAllocationsByWarehouseIdAndMarketIdAndSku(Long mallId, String sku, Long warehouseId);
List<String> findOrderPackageCodesByOrderPackageCodeList(List<String> orderPackageCodeList, Long warehouseId);
} }

11
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayGoodsServiceImpl.java

@ -102,6 +102,17 @@ public class WarehouseTrayGoodsServiceImpl extends BaseServiceImpl<WarehouseTray
return list.size(); return list.size();
} }
@Override
public Integer deleteByTrayGoodsIds(List<Long> trayGoodsIds, Long trayTypeId,Long warehouseId) {
baseMapper.deleteEntityByTrayGoodsIds(trayGoodsIds);
QueryWrapper<WarehouseTrayGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_type_id",trayTypeId);
List<WarehouseTrayGoodsEntity> list = baseMapper.selectList(queryWrapper);
return list.size();
}
@Override @Override
public Boolean downZeroByTrayId(Long trayId,Long orderId,Long warehouseId,Integer num,String remark) { public Boolean downZeroByTrayId(Long trayId,Long orderId,Long warehouseId,Integer num,String remark) {
WarehouseTrayGoodsEntity trayGoodsEntity = baseMapper.selectOne(Wrappers.<WarehouseTrayGoodsEntity>query().lambda() WarehouseTrayGoodsEntity trayGoodsEntity = baseMapper.selectOne(Wrappers.<WarehouseTrayGoodsEntity>query().lambda()

296
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -62,6 +62,8 @@ import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
@Log4j2 @Log4j2
@Service @Service
@ -686,6 +688,193 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
} }
} }
public void orderScanOrderPackageCodeList(WarehouseTrayTypeEntity trayTypeEntity, List<DistributionParcelListEntity> parcelListEntityList,Long warehouseId,String remark) {
String tt = trayTypeEntity.getTrayType();
Long filterId = trayTypeEntity.getFilterId();
String filterValue = trayTypeEntity.getFilterValue();
if(StringUtil.isBlank(filterValue)){
filterValue = "";
}
Long trayTypeId = trayTypeEntity.getId();
Long trayTypeEntityWarehouseId = trayTypeEntity.getWarehouseId();
if(!trayTypeEntityWarehouseId.equals(warehouseId)){
log.warn("##############orderScanOrderPackageCode: 托盘已在其他仓库打托 {}={}",trayTypeEntityWarehouseId,warehouseId);
throw new CustomerException(2001,"托盘已在其他仓库打托");
}
//把parcelListEntityList通过orderCode进行分组
Map<String, List<DistributionParcelListEntity>> map = parcelListEntityList.stream().collect(Collectors.groupingBy(DistributionParcelListEntity::getOrderCode));
List<DistributionStockArticleEntity> stockArticleEntityList = distributionStockArticleClient.findListByOrderCodesAndWarehouseId(map.keySet(), warehouseId);
//把stockArticleEntityList转化成orderCode为key的Map
Map<String, DistributionStockArticleEntity> stockArticleEntityMap = stockArticleEntityList.stream().collect(Collectors.toMap(DistributionStockArticleEntity::getOrderCode, Function.identity()));
Map<String, Integer> orderPackageChuanMap = new HashMap<>();
String finalFilterValue = filterValue;
parcelListEntityList.forEach(parcelListEntity -> {
String orderPackageCode = parcelListEntity.getOrderPackageCode();
String orderCode = parcelListEntity.getOrderCode();
DistributionStockArticleEntity stockArticleEntity = stockArticleEntityMap.get(orderCode);
boolean chuanFlag = false;
String msg = "";
if("10".equals(tt)){//服务号
String serviceNumber = stockArticleEntity.getServiceNumber();
if(!finalFilterValue.equals(serviceNumber)){
chuanFlag = true;
msg = "服务号"+ finalFilterValue;
}
}else if("20".equals(tt)){//订单自编号
String oc = stockArticleEntity.getOrderCode();
if(!finalFilterValue.equals(oc)){
chuanFlag = true;
msg = "订单自编号"+ finalFilterValue;
}
}else if("30".equals(tt)){//商场
Long mallId = stockArticleEntity.getMallId();
String mallName = null;
if(!Objects.isNull(mallId)){
mallName = stockArticleEntity.getMallName();
}else{
String dealerName = stockArticleEntity.getDealerName();
String brand = stockArticleEntity.getBrand();
Long clientId = basicdataTripartiteMallClient.getClientIdByNameAndBrand(dealerName, brand);
if(!Objects.isNull(clientId)){
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findEntityById(clientId);
if(Objects.isNull(basicdataClientEntity)){
log.error("#############saveTrayTypeByOrderPackageCode: 未找到三方商场对应的汇通商场 clientId={}",clientId);
throw new CustomerException(405,"未找到三方商场对应的汇通商场");
}
mallName = basicdataClientEntity.getClientName();
}else{
mallName = dealerName;
}
}
if(!finalFilterValue.equals(mallName)){
chuanFlag = true;
msg = "商场"+ finalFilterValue;
}
}else if("40".equals(tt)){//门店
Long storeId = stockArticleEntity.getStoreId();
String storeName = stockArticleEntity.getStoreName();
if(!finalFilterValue.equals(storeName)){
chuanFlag = true;
msg = "门店"+ finalFilterValue;
}
}else if("50".equals(tt)){//客户
String customerName = stockArticleEntity.getCustomerName();
String customerTelephone = stockArticleEntity.getCustomerTelephone();
if(!finalFilterValue.equals(customerName+customerTelephone)){
chuanFlag = true;
msg = "客户"+ finalFilterValue;
}
}else if("60".equals(tt)){//仓库
String warehouse = null;
String waybillNumber = parcelListEntity.getWaybillNumber();
if(StringUtil.isBlank(waybillNumber)){
//如果运单为空则去找有没有对应的dealName是否有对应的维护的商场信息
String brand = stockArticleEntity.getBrand();
String dealerName = parcelListEntity.getDealerName();
Long clientId = basicdataTripartiteMallClient.getClientIdByNameAndBrand(dealerName, brand);
if(!Objects.isNull(clientId)){
BasicdataStorageServicesEntity storageServicesEntity = basicdataStorageServicesClient.findEntityBySendWarehouseIdAndClientId(warehouseId, clientId);
if(!Objects.isNull(storageServicesEntity)){
warehouse = storageServicesEntity.getServeWarehouseName();
}else{
warehouse = "";
}
}else{
warehouse = "";
}
}else{
WarehouseWaybillEntity waybillEntity = warehouseWaybillService.findByWaybillNo(waybillNumber);
if(!Objects.isNull(waybillEntity)){
warehouse = waybillEntity.getDestinationWarehouseName();
}else{
warehouse = "";
}
}
if(!finalFilterValue.equals(warehouse)){
chuanFlag = true;
msg = "仓库"+ finalFilterValue;
}
}
orderPackageChuanMap.put(orderPackageCode,chuanFlag?1:0);
});
List<WarehouseTrayGoodsEntity> trayGoodsEntities = new ArrayList<>();
List<WarehouseTrayGoodsLogEntity> trayGoodsLogEntities = new ArrayList<>();
parcelListEntityList.forEach(parcelListEntity -> {
String orderPackageCode = parcelListEntity.getOrderPackageCode();
Integer chuanFlag = orderPackageChuanMap.get(orderPackageCode);
if(Objects.isNull(chuanFlag)){
chuanFlag = 1;
}
Date date = new Date();
WarehouseTrayGoodsEntity trayGoodsEntity = new WarehouseTrayGoodsEntity();
BladeUser user = AuthUtil.getUser();
if(user==null){
trayGoodsEntity.setTenantId(TenantNum.HUITONGCODE);
trayGoodsEntity.setCreateUser(1714696768639311873L);
trayGoodsEntity.setUpdateUser(1714696768639311873L);
trayGoodsEntity.setCreateDept(1649331096241836033L);
}
trayGoodsEntity.setTrayId(trayTypeEntity.getTrayId());
trayGoodsEntity.setTrayTypeId(trayTypeEntity.getId());
trayGoodsEntity.setTrayCode(trayTypeEntity.getTrayCode());
trayGoodsEntity.setGoodsType(1);
trayGoodsEntity.setAssociationId(parcelListEntity.getId());
trayGoodsEntity.setAssociationValue(parcelListEntity.getOrderPackageCode());
trayGoodsEntity.setAssociationType("3");
trayGoodsEntity.setGoodsName(parcelListEntity.getMaterialName());
trayGoodsEntity.setNum(1);
if(chuanFlag.equals(1)){
trayGoodsEntity.setIsFleeing("1");
}else{
trayGoodsEntity.setIsFleeing("0");
}
trayGoodsEntity.setWarehouseId(trayTypeEntity.getWarehouseId());
trayGoodsEntities.add(trayGoodsEntity);
WarehouseTrayGoodsLogEntity trayGoodsLogEntity = new WarehouseTrayGoodsLogEntity();
if(user==null){
trayGoodsLogEntity.setTenantId(TenantNum.HUITONGCODE);
trayGoodsLogEntity.setCreateUser(1714696768639311873L);
trayGoodsLogEntity.setUpdateUser(1714696768639311873L);
trayGoodsLogEntity.setCreateDept(1649331096241836033L);
}
trayGoodsLogEntity.setTrayId(trayTypeEntity.getTrayId());
trayGoodsLogEntity.setTrayTypeId(trayTypeEntity.getId());
trayGoodsLogEntity.setAssociationId(parcelListEntity.getId());
trayGoodsLogEntity.setAssociationValue(parcelListEntity.getOrderPackageCode());
trayGoodsLogEntity.setAssociationType("3");
trayGoodsLogEntity.setBindingType("1");
trayGoodsLogEntity.setRemark(remark);
trayGoodsLogEntity.setPalletizingType("1");
trayGoodsLogEntity.setNum(1);
trayGoodsLogEntity.setWarehouseId(trayTypeEntity.getWarehouseId());
trayGoodsLogEntities.add(trayGoodsLogEntity);
});
warehouseTrayGoodsService.saveBatch(trayGoodsEntities);
warehouseTrayGoodsLogService.saveBatch(trayGoodsLogEntities);
//更新打托方式上的值
updateNumByTrayTypeId(trayTypeEntity);
}
@Override @Override
public R orderScanOrderPackageCodeSync(String trayType, String trayCode, String orderPackageCode,Long warehouseId) { public R orderScanOrderPackageCodeSync(String trayType, String trayCode, String orderPackageCode,Long warehouseId) {
@ -2150,6 +2339,113 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
} }
} }
@Transactional(rollbackFor = Exception.class)
@Override
public void downPackageByOrderPackageCodeList(List<String> orderPackageCodeList,String remark,Long warehouseId) {
// List<DistributionParcelListEntity> distributionParcelListEntities = distributionParcelListClient.findListByOrderPackageCodeList(orderPackageCodeList,warehouseId);
// //把distributionParcelListEntities转化成orderPackageCode为key的Map
// Map<String, DistributionParcelListEntity> orderPackageCodeToParcelMap = distributionParcelListEntities.stream()
// .collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity(), (entity1, entity2) -> entity1));
QueryWrapper<WarehouseTrayGoodsEntity> trayGoodsQueryWrapper = new QueryWrapper<>();
trayGoodsQueryWrapper.eq("association_type","3")
.in("association_value",orderPackageCodeList);
List<WarehouseTrayGoodsEntity> trayGoodsEntityList = warehouseTrayGoodsService.list(trayGoodsQueryWrapper);
//把trayGoodsEntityList通过trayTypeId进行分组
Map<Long, List<WarehouseTrayGoodsEntity>> trayTypeIdToTrayGoodsListMap = trayGoodsEntityList.stream()
.collect(Collectors.groupingBy(WarehouseTrayGoodsEntity::getTrayTypeId));
Set<Long> trayTypeIds = trayTypeIdToTrayGoodsListMap.keySet();
List<WarehouseTrayTypeEntity> warehouseTrayTypeEntities = baseMapper.selectBatchIds(trayTypeIds);
Map<Long, WarehouseTrayTypeEntity> trayTypeMap = warehouseTrayTypeEntities.stream()
.collect(Collectors.toMap(WarehouseTrayTypeEntity::getId, Function.identity(), (entity1, entity2) -> entity1));
List<Long> toNullTrayTypeIds = new ArrayList<>();
List<Long> updateTrayTypeIds = new ArrayList<>();
List<Long> updateTrayIds = new ArrayList<>();
List<WarehouseTrayGoodsLogEntity> addTrayGoodsLogEntities = new ArrayList<>();
trayTypeIdToTrayGoodsListMap.keySet().forEach(trayTypeId -> {
List<WarehouseTrayGoodsEntity> warehouseTrayGoodsEntities = trayTypeIdToTrayGoodsListMap.get(trayTypeId);
if(!warehouseTrayGoodsEntities.isEmpty()){
WarehouseTrayTypeEntity trayTypeEntity = trayTypeMap.get(trayTypeId);
Long trayId = trayTypeEntity.getTrayId();
warehouseTrayGoodsEntities.forEach(warehouseTrayGoodsEntity -> {
WarehouseTrayGoodsLogEntity trayGoodsLogEntity = new WarehouseTrayGoodsLogEntity();
trayGoodsLogEntity.setTrayId(warehouseTrayGoodsEntity.getTrayId());
trayGoodsLogEntity.setTrayTypeId(trayTypeId);
trayGoodsLogEntity.setAssociationId(warehouseTrayGoodsEntity.getAssociationId());
trayGoodsLogEntity.setAssociationValue(warehouseTrayGoodsEntity.getAssociationValue());
trayGoodsLogEntity.setAssociationType("3");
trayGoodsLogEntity.setBindingType("0");
trayGoodsLogEntity.setRemark(remark);
trayGoodsLogEntity.setPalletizingType("1");
trayGoodsLogEntity.setNum(1);
trayGoodsLogEntity.setWarehouseId(warehouseId);
addTrayGoodsLogEntities.add(trayGoodsLogEntity);
});
List<Long> trayGoodsIds = warehouseTrayGoodsEntities.stream()
.map(WarehouseTrayGoodsEntity::getId)
.collect(Collectors.toList());
Integer residueNum = warehouseTrayGoodsService.deleteByTrayGoodsIds(trayGoodsIds, trayTypeId, warehouseId);
if(residueNum == 0){
//空置托盘
toNullTrayTypeIds.add(trayTypeId);
//更新托盘状态
updateTrayIds.add(trayId);
}else{
updateTrayTypeIds.add(trayTypeId);
}
}
});
//空置的托盘打托id
removeByIds(toNullTrayTypeIds);
//更新托盘状态
basicdataTrayClient.updateTrayStatusByTrayIds(updateTrayIds,1);
//添加下托日志
warehouseTrayGoodsLogService.saveBatch(addTrayGoodsLogEntities);
updateTrayTypeIds.forEach(trayTypeId -> {
WarehouseTrayTypeEntity trayTypeEntity = trayTypeMap.get(trayTypeId);
if(!Objects.isNull(trayTypeEntity)){
updateNumByTrayTypeId(trayTypeEntity);
}
});
// if (!Objects.isNull(trayGoodsEntity)){
// Long trayGoodsId = trayGoodsEntity.getId();
// Long trayTypeId = trayGoodsEntity.getTrayTypeId();
// Long trayId = trayGoodsEntity.getTrayId();
// WarehouseTrayTypeEntity trayTypeEntity = baseMapper.selectById(trayTypeId);
// //解除绑定
// Integer residueNum = warehouseTrayGoodsService.deleteByTrayGoodsId(trayGoodsId,warehouseId);
//
// if(residueNum == 0){
// //空置托盘
// removeById(trayTypeId);
// //更新托盘状态
// basicdataTrayClient.updateTrayStatus(trayId,1);
// }
//
// //添加下托日志
// warehouseTrayGoodsLogService.saveLogPackage(parcelListEntity,trayTypeEntity,"0",remark,"1");
//
// updateNumByTrayTypeId(trayTypeEntity);
// }else {
// stringBuffer.append(orderPackageCode);
// }
// if (Func.isNotEmpty(stringBuffer)){
// log.error("托盘商品不存在,trayId:{}",stringBuffer.toString());
// }
}
@Override @Override
public void updateEntityNumByTrayGoodsIdAndNumStock(Long trayGoodsId, Integer enterNum,String remark) { public void updateEntityNumByTrayGoodsIdAndNumStock(Long trayGoodsId, Integer enterNum,String remark) {
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getById(trayGoodsId); WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getById(trayGoodsId);

74
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownGoodsServiceImpl.java

@ -21,6 +21,7 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionParcelListEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity; import com.logpm.warehouse.entity.WarehouseUpdownGoodsEntity;
import com.logpm.warehouse.entity.WarehouseUpdownGoodsLogEntity;
import com.logpm.warehouse.entity.WarehouseUpdownTypeEntity; import com.logpm.warehouse.entity.WarehouseUpdownTypeEntity;
import com.logpm.warehouse.excel.WarehouseUpdownGoodsExcel; import com.logpm.warehouse.excel.WarehouseUpdownGoodsExcel;
import com.logpm.warehouse.mapper.WarehouseUpdownGoodsMapper; import com.logpm.warehouse.mapper.WarehouseUpdownGoodsMapper;
@ -124,6 +125,65 @@ public class WarehouseUpdownGoodsServiceImpl extends BaseServiceImpl<WarehouseUp
warehouseUpdownGoodsLogService.saveAllocationAndPackage(updownTypeEntity,parcelListEntity,bindingType,isAlltrays,remark); warehouseUpdownGoodsLogService.saveAllocationAndPackage(updownTypeEntity,parcelListEntity,bindingType,isAlltrays,remark);
} }
@Override
public void bindingAllocationAndPackageList(WarehouseUpdownTypeEntity updownTypeEntity, List<DistributionParcelListEntity> parcelListEntities, String bindingType,Integer isAlltrays,String remark) {
List<WarehouseUpdownGoodsEntity> updownGoodsEntities = new ArrayList<>();
List<WarehouseUpdownGoodsLogEntity> updownGoodsLogEntities = new ArrayList<>();
parcelListEntities.forEach(parcelListEntity -> {
WarehouseUpdownGoodsEntity updownGoodsEntity = new WarehouseUpdownGoodsEntity();
updownGoodsEntity.setCreateUser(1714696768639311873L);
updownGoodsEntity.setUpdateUser(1714696768639311873L);
updownGoodsEntity.setCreateDept(1649331096241836033L);
updownGoodsEntity.setTenantId(TenantNum.HUITONGCODE);
updownGoodsEntity.setUpdownTypeId(updownTypeEntity.getId());
updownGoodsEntity.setAreaId(updownTypeEntity.getAreaId());
updownGoodsEntity.setAreaTitle(updownTypeEntity.getAreaTitle());
updownGoodsEntity.setShelfId(updownTypeEntity.getShelfId());
updownGoodsEntity.setShelfTitle(updownTypeEntity.getShelfTitle());
updownGoodsEntity.setAllocationId(updownTypeEntity.getAllocationId());
updownGoodsEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle());
updownGoodsEntity.setPositionCode(updownTypeEntity.getPositionCode());
updownGoodsEntity.setAssociationId(parcelListEntity.getId());
updownGoodsEntity.setAssociationValue(parcelListEntity.getOrderPackageCode());
updownGoodsEntity.setAssociationType("3");//包件
updownGoodsEntity.setNum(1);
updownGoodsEntity.setWarehouseId(updownTypeEntity.getWarehouseId());
updownGoodsEntities.add(updownGoodsEntity);
WarehouseUpdownGoodsLogEntity warehouseUpdownGoodsLogEntity = new WarehouseUpdownGoodsLogEntity();
warehouseUpdownGoodsLogEntity.setCreateUser(1714696768639311873L);
warehouseUpdownGoodsLogEntity.setUpdateUser(1714696768639311873L);
warehouseUpdownGoodsLogEntity.setCreateDept(1649331096241836033L);
warehouseUpdownGoodsLogEntity.setTenantId(TenantNum.HUITONGCODE);
warehouseUpdownGoodsLogEntity.setUpdownTypeId(updownTypeEntity.getId());
warehouseUpdownGoodsLogEntity.setAreaId(updownTypeEntity.getAreaId());
warehouseUpdownGoodsLogEntity.setAreaTitle(updownTypeEntity.getAreaTitle());
warehouseUpdownGoodsLogEntity.setShelfId(updownTypeEntity.getShelfId());
warehouseUpdownGoodsLogEntity.setShelfTitle(updownTypeEntity.getShelfTitle());
warehouseUpdownGoodsLogEntity.setAllocationId(updownTypeEntity.getAllocationId());
warehouseUpdownGoodsLogEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle());
warehouseUpdownGoodsLogEntity.setPositionCode(updownTypeEntity.getPositionCode());
warehouseUpdownGoodsLogEntity.setBindingType(bindingType);
warehouseUpdownGoodsLogEntity.setIsAlltrays(isAlltrays);
warehouseUpdownGoodsLogEntity.setAssociationId(parcelListEntity.getId());
warehouseUpdownGoodsLogEntity.setAssociationValue(parcelListEntity.getOrderPackageCode());
warehouseUpdownGoodsLogEntity.setAssociationType("3");
warehouseUpdownGoodsLogEntity.setNum(1);
warehouseUpdownGoodsLogEntity.setRemark(remark);
warehouseUpdownGoodsLogEntity.setWarehouseId(updownTypeEntity.getWarehouseId());
updownGoodsLogEntities.add(warehouseUpdownGoodsLogEntity);
parcelListEntity.setOrderPackageGroundingStatus("20");
});
saveBatch(updownGoodsEntities);
warehouseUpdownGoodsLogService.saveBatch(updownGoodsLogEntities);
}
@Override @Override
public Map<String, Integer> getTotalNumberAndNum(Long updownTypeId) { public Map<String, Integer> getTotalNumberAndNum(Long updownTypeId) {
return baseMapper.getTotalNumberAndNum(updownTypeId); return baseMapper.getTotalNumberAndNum(updownTypeId);
@ -173,6 +233,15 @@ public class WarehouseUpdownGoodsServiceImpl extends BaseServiceImpl<WarehouseUp
return updownGoodsEntities.size(); return updownGoodsEntities.size();
} }
@Override
public Integer deleteByUpdownGoodsIds(List<Long> updownGoodsIds,Long updownTypeId) {
baseMapper.deleteByUpdownGoodsIds(updownGoodsIds);
QueryWrapper<WarehouseUpdownGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("updown_type_id",updownTypeId);
List<WarehouseUpdownGoodsEntity> updownGoodsEntities = baseMapper.selectList(queryWrapper);
return updownGoodsEntities.size();
}
@Override @Override
public void updeteNumByUpdownGoodsId(int num, Long updownGoodsId) { public void updeteNumByUpdownGoodsId(int num, Long updownGoodsId) {
baseMapper.updeteNumByUpdownGoodsId(num,updownGoodsId); baseMapper.updeteNumByUpdownGoodsId(num,updownGoodsId);
@ -273,4 +342,9 @@ public class WarehouseUpdownGoodsServiceImpl extends BaseServiceImpl<WarehouseUp
return baseMapper.getAllocationsByWarehouseIdAndMarketIdAndSku(mallId,sku,warehouseId); return baseMapper.getAllocationsByWarehouseIdAndMarketIdAndSku(mallId,sku,warehouseId);
} }
@Override
public List<String> findOrderPackageCodesByOrderPackageCodeList(List<String> orderPackageCodeList, Long warehouseId) {
return baseMapper.findOrderPackageCodesByOrderPackageCodeList(orderPackageCodeList,warehouseId);
}
} }

363
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

@ -32,6 +32,7 @@ import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.*; import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors; import java.util.stream.Collectors;
@Log4j2 @Log4j2
@ -828,19 +829,18 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
public R upShelfOrder(List<UpShelfOrderDTO> upShelfOrderList, Long allocationId, Long warehouseId, String remrk) { public R upShelfOrder(List<UpShelfOrderDTO> upShelfOrderList, Long allocationId, Long warehouseId, String remrk) {
int num = 0; int num = 0;
String trayCode = null; String trayCode = null;
WarehouseTrayTypeEntity trayTypeEntity = null;
//判断货位是否有托盘 //判断货位是否有托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId); BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId);
String trayType = null; String trayType = null;
if (!Objects.isNull(trayEntity)) { if (!Objects.isNull(trayEntity)) {
trayCode = trayEntity.getPalletCode(); trayCode = trayEntity.getPalletCode();
//如果有托盘 QueryWrapper<WarehouseTrayTypeEntity> queryWrapper = new QueryWrapper<>();
TrayTypeDataVO entityByTrayCode = warehouseTrayTypeService.getEntityByTrayCodeWithUpdown(trayCode); queryWrapper.eq("tray_code", trayCode)
trayType = entityByTrayCode.getTrayType(); .eq("is_deleted", 0);
// String type = entityByTrayCode.getType();//数据类型 1订制品 2零担 3 4 库存品 trayTypeEntity = warehouseTrayTypeService.getOne(queryWrapper);
// if(!"1".equals(type)){ trayType = trayTypeEntity.getTrayType();
// log.warn("##############upShelfOrder: 库位上的托盘是定制品类型 allocationId={}",allocationId);
// return R.fail(403,"库位上的托盘是定制品类型");
// }
} }
@ -877,46 +877,27 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
return R.fail(403, "库位不属于当前仓库"); return R.fail(403, "库位不属于当前仓库");
} }
//把upShelfOrderList中的orderCode提取到一个Set集合中
List<String> orderCodeList = upShelfOrderList.stream().map(UpShelfOrderDTO::getOrderCode).collect(Collectors.toList());
List<DistributionParcelListEntity> parcelListList = distributionParcelListClient.findALLNoUpShelfPackageByOrderCodeList(orderCodeList, warehouseId);
for (UpShelfOrderDTO upShelfOrderDTO : upShelfOrderList) { List<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>();
String orderCode = upShelfOrderDTO.getOrderCode();
if (StringUtil.isBlank(orderCode)) {
log.warn("##############upShelfOrder: 订单号不存在 orderCode={}", orderCode);
continue;
}
//查询所有该订单号未上架的数据
List<DistributionParcelListEntity> parcelListList = distributionParcelListClient.findALLNoUpShelfPackageByOrderCode(orderCode, warehouseId);
for (DistributionParcelListEntity parcelListEntity : parcelListList) {
try {
String orderPackageCode = parcelListEntity.getOrderPackageCode();
Integer quantity = parcelListEntity.getQuantity();
if (StringUtil.hasLength(trayCode)) {
//存入托盘信息 parcelListList.forEach(parcelListEntity -> {
warehouseTrayTypeService.orderScanOrderPackageCode(trayType, trayCode, orderPackageCode, warehouseId, remrk + "并上架"); UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO();
} upShelfPackageDTO.setOrderPackageCode(parcelListEntity.getOrderPackageCode());
//包件级别的上架 upShelfPackageList.add(upShelfPackageDTO);
upShelfPackageNoTray(parcelListEntity, goodsAllocationEntity, goodsShelfEntity, goodsAreaEntity, warehouseId, remrk); });
num = num + quantity; return upShelfPackage(upShelfPackageList, allocationId, warehouseId, remrk);
} catch (CustomerException e) {
log.warn(e.message);
continue;
} catch (Exception e) {
log.warn(e.getMessage());
continue;
}
}
}
return Resp.scanSuccess("上架成功", "成功上架" + num + "条");
} }
@Transactional(rollbackFor = Exception.class)
@Override @Override
public R upShelfPackage(List<UpShelfPackageDTO> upShelfPackageList, Long allocationId, Long warehouseId, String remark) { public R upShelfPackage(List<UpShelfPackageDTO> upShelfPackageList, Long allocationId, Long warehouseId, String remark) {
int num = 0; int num = 0;
String trayCode = null; String trayCode = null;
String trayType = null; WarehouseTrayTypeEntity trayTypeEntity = null;
//判断货位是否有托盘 //判断货位是否有托盘
BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId); BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId);
if (!Objects.isNull(trayEntity)) { if (!Objects.isNull(trayEntity)) {
@ -925,8 +906,7 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
QueryWrapper<WarehouseTrayTypeEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<WarehouseTrayTypeEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_code", trayCode) queryWrapper.eq("tray_code", trayCode)
.eq("is_deleted", 0); .eq("is_deleted", 0);
WarehouseTrayTypeEntity trayTypeEntity = warehouseTrayTypeService.getOne(queryWrapper); trayTypeEntity = warehouseTrayTypeService.getOne(queryWrapper);
trayType = trayTypeEntity.getTrayType();
// String type = trayTypeEntity.getType();//数据类型 1订制品 2零担 3 4 库存品 // String type = trayTypeEntity.getType();//数据类型 1订制品 2零担 3 4 库存品
// if(!"1".equals(type)){ // if(!"1".equals(type)){
// log.warn("##############upShelfOrder: 库位上的托盘是定制品类型 allocationId={}",allocationId); // log.warn("##############upShelfOrder: 库位上的托盘是定制品类型 allocationId={}",allocationId);
@ -973,60 +953,89 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
return R.fail(403, "库位不属于本仓库"); return R.fail(403, "库位不属于本仓库");
} }
//把upShelfPackageList中所有orderPackageCode存入一个List<String>
List<String> orderPackageCodeList = upShelfPackageList.stream().map(UpShelfPackageDTO::getOrderPackageCode).collect(Collectors.toList());
log.info("##############upShelfPackage: 当前处理的包件码 orderPackageCodeList={}", orderPackageCodeList);
//判断包件是否已经上架
List<String> hasOrderPackageCodes = warehouseUpdownGoodsService.findOrderPackageCodesByOrderPackageCodeList(orderPackageCodeList, warehouseId);
orderPackageCodeList.removeAll(hasOrderPackageCodes);
for (UpShelfPackageDTO upShelfPackageDTO : upShelfPackageList) { //判断包件是否有绑托盘,
String orderPackageCode = upShelfPackageDTO.getOrderPackageCode(); QueryWrapper<WarehouseTrayGoodsEntity> trayGoodsQueryWrapper = new QueryWrapper<>();
log.info("##############upShelfPackage: 当前处理的包件码 orderPackageCode={}", orderPackageCode); trayGoodsQueryWrapper.in("association_value", orderPackageCodeList);
try { List<WarehouseTrayGoodsEntity> trayGoodsEntityList = warehouseTrayGoodsService.list(trayGoodsQueryWrapper);
//判断包件是否已经上架 if(!trayGoodsEntityList.isEmpty()){
QueryWrapper<WarehouseUpdownGoodsEntity> queryWrapper = new QueryWrapper<>(); //把trayGoodsEntityList中的association_value提取出来存入一个List<String>
queryWrapper.eq("association_value", orderPackageCode) List<String> orderPackageCodes = trayGoodsEntityList.stream().map(WarehouseTrayGoodsEntity::getAssociationValue).collect(Collectors.toList());
.eq("warehouse_id", warehouseId); warehouseTrayTypeService.downPackageByOrderPackageCodeList(orderPackageCodes,"同步处理:包件解托",warehouseId);
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(queryWrapper); }
if (!Objects.isNull(updownGoodsEntity)) { List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(orderPackageCodeList, warehouseId);
log.warn("##############upShelfPackage: 包件已上架 orderPackageCode={}", orderPackageCode); //排除parcelListEntityList中元素orderPackageStatus 不等于20的
continue; parcelListEntityList = parcelListEntityList.stream().filter(parcelListEntity -> "20".equals(parcelListEntity.getOrderPackageStatus())).collect(Collectors.toList());
}
//判断包件是否有绑托盘,
QueryWrapper<WarehouseTrayGoodsEntity> trayGoodsQueryWrapper = new QueryWrapper<>();
trayGoodsQueryWrapper.eq("association_value", orderPackageCode);
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(trayGoodsQueryWrapper);
if (!Objects.isNull(trayGoodsEntity)) {
// log.warn("##############upShelfPackage: 包件已打托 orderPackageCode={}",orderPackageCode);
// continue;
//已打托的数据需要取消托盘绑定
warehouseTrayTypeService.downPackageByOrderPackageCode(orderPackageCode, "扫描上架:包件下托", warehouseId);
}
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId); if (StringUtil.hasLength(trayCode)) {
Integer conditions = parcelListEntity.getConditions(); //存入托盘信息
Integer quantity = parcelListEntity.getQuantity(); warehouseTrayTypeService.orderScanOrderPackageCodeList(trayTypeEntity, parcelListEntityList, warehouseId, remark + "并打托");
String orderPackageStatus = parcelListEntity.getOrderPackageStatus();
if (!"20".equals(orderPackageStatus)) {
log.warn("##############upShelfPackage: 包件已不在库 orderPackageCode={} warehouseId={}", orderPackageCode, warehouseId);
return Resp.scanFail(403, "包件已不在库", "包件已不在库");
}
// if(conditions != 1){
// log.warn("##############upShelfPackage: 包件已转库存品 orderPackageCode={}",orderPackageCode);
// continue;
// }
if (StringUtil.hasLength(trayCode)) {
//存入托盘信息
warehouseTrayTypeService.orderScanOrderPackageCode(trayType, trayCode, orderPackageCode, warehouseId, remark + "并打托");
}
//包件级别的上架
upShelfPackageNoTray(parcelListEntity, goodsAllocationEntity, goodsShelfEntity, goodsAreaEntity, warehouseId, remark);
num = num + quantity;
} catch (CustomerException e) {
log.warn(e.message);
continue;
} catch (Exception e) {
log.warn(e.getMessage());
continue;
}
} }
//包件级别的上架
upShelfPackageListNoTray(parcelListEntityList, goodsAllocationEntity, goodsShelfEntity, goodsAreaEntity, warehouseId, remark);
num = num + parcelListEntityList.size();
//更新货位缓存 //更新货位缓存
warehouseGoodsAllocationClient.updateAllocationCache(allocationId.toString()); warehouseGoodsAllocationClient.updateAllocationCache(allocationId.toString());
// for (UpShelfPackageDTO upShelfPackageDTO : upShelfPackageList) {
// String orderPackageCode = upShelfPackageDTO.getOrderPackageCode();
// log.info("##############upShelfPackage: 当前处理的包件码 orderPackageCode={}", orderPackageCode);
// try {
// //判断包件是否已经上架
// QueryWrapper<WarehouseUpdownGoodsEntity> queryWrapper = new QueryWrapper<>();
// queryWrapper.eq("association_value", orderPackageCode)
// .eq("warehouse_id", warehouseId);
// WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(queryWrapper);
// if (!Objects.isNull(updownGoodsEntity)) {
// log.warn("##############upShelfPackage: 包件已上架 orderPackageCode={}", orderPackageCode);
// continue;
// }
// //判断包件是否有绑托盘,
// QueryWrapper<WarehouseTrayGoodsEntity> trayGoodsQueryWrapper = new QueryWrapper<>();
// trayGoodsQueryWrapper.eq("association_value", orderPackageCode);
// WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(trayGoodsQueryWrapper);
// if (!Objects.isNull(trayGoodsEntity)) {
//// log.warn("##############upShelfPackage: 包件已打托 orderPackageCode={}",orderPackageCode);
//// continue;
// //已打托的数据需要取消托盘绑定
// warehouseTrayTypeService.downPackageByOrderPackageCode(orderPackageCode, "扫描上架:包件下托", warehouseId);
// }
//
// DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
// Integer conditions = parcelListEntity.getConditions();
// Integer quantity = parcelListEntity.getQuantity();
// String orderPackageStatus = parcelListEntity.getOrderPackageStatus();
// if (!"20".equals(orderPackageStatus)) {
// log.warn("##############upShelfPackage: 包件已不在库 orderPackageCode={} warehouseId={}", orderPackageCode, warehouseId);
// return Resp.scanFail(403, "包件已不在库", "包件已不在库");
// }
//// if(conditions != 1){
//// log.warn("##############upShelfPackage: 包件已转库存品 orderPackageCode={}",orderPackageCode);
//// continue;
//// }
// if (StringUtil.hasLength(trayCode)) {
// //存入托盘信息
// warehouseTrayTypeService.orderScanOrderPackageCodeList(trayTypeEntity, orderPackageCodeList, warehouseId, remark + "并打托");
// }
// //包件级别的上架
// upShelfPackageNoTray(parcelListEntity, goodsAllocationEntity, goodsShelfEntity, goodsAreaEntity, warehouseId, remark);
// num = num + quantity;
// } catch (CustomerException e) {
// log.warn(e.message);
// continue;
// } catch (Exception e) {
// log.warn(e.getMessage());
// continue;
// }
// }
return Resp.scanSuccess("上架成功", "成功上架" + num + "条"); return Resp.scanSuccess("上架成功", "成功上架" + num + "条");
} }
@ -1405,58 +1414,133 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
@Override @Override
public R downPackage(List<UpShelfPackageDTO> upShelfPackageList, Long warehouseId, String remark) { public R downPackage(List<UpShelfPackageDTO> upShelfPackageList, Long warehouseId, String remark) {
int num = 0; int num = 0;
Set<String> orderSet = new TreeSet<>(); Set<String> orderSet = new HashSet<>();
for (UpShelfPackageDTO upShelfPackageDTO : upShelfPackageList) {
String orderPackageCode = upShelfPackageDTO.getOrderPackageCode(); //把upShelfPackageList中的orderPackageCde提取到List中
//查询包件在哪个库位上 List<String> orderPackageCodeList = upShelfPackageList.stream().map(UpShelfPackageDTO::getOrderPackageCode).collect(Collectors.toList());
QueryWrapper<WarehouseUpdownGoodsEntity> queryWrapper = new QueryWrapper<>(); QueryWrapper<WarehouseUpdownGoodsEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("association_type", "3") queryWrapper.eq("association_type", "3")
.eq("warehouse_id", warehouseId) .eq("warehouse_id", warehouseId)
.eq("association_value", orderPackageCode); .in("association_value", orderPackageCodeList);
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(queryWrapper); List<WarehouseUpdownGoodsEntity> updownGoodsEntities = warehouseUpdownGoodsService.list(queryWrapper);
if (Objects.isNull(updownGoodsEntity)) {
log.warn("##############downPackage: 包件没有上架记录 orderPackageCode={}", orderPackageCode); //把updownGoodsEntities的association_value提取到一个List中
continue; List<String> associationValueList = updownGoodsEntities.stream().map(WarehouseUpdownGoodsEntity::getAssociationValue).collect(Collectors.toList());
}
Long allocationId = updownGoodsEntity.getAllocationId(); List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.findListByOrderPackageCodeList(associationValueList, warehouseId);
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId); //把parcelListEntityList转化成orderPackageCode为key的Map
Integer quantity = parcelListEntity.getQuantity(); Map<String, DistributionParcelListEntity> parcelListEntityMap = parcelListEntityList.stream().collect(Collectors.toMap(DistributionParcelListEntity::getOrderPackageCode, Function.identity()));
String orderCode = parcelListEntity.getOrderCode();
Long updownGoodsId = updownGoodsEntity.getId(); //把updownGoodsEntities通过allocatiionId进行分组
Long updownTypeId = updownGoodsEntity.getUpdownTypeId(); Map<Long, List<WarehouseUpdownGoodsEntity>> map = updownGoodsEntities.stream().collect(Collectors.groupingBy(WarehouseUpdownGoodsEntity::getAllocationId));
WarehouseUpdownTypeEntity updownTypeEntity = baseMapper.selectById(updownTypeId);
List<Long> allocationIds = new ArrayList<>(map.keySet());
QueryWrapper<WarehouseUpdownTypeEntity> updownTypeEntityQueryWrapper = new QueryWrapper<>();
updownTypeEntityQueryWrapper.in("allocation_id", allocationIds)
.eq("is_deleted", 0);
List<WarehouseUpdownTypeEntity> updownTypeList = list(updownTypeEntityQueryWrapper);
//把updownTypeList转化成allocationId为key的Map
Map<Long, WarehouseUpdownTypeEntity> updownTypeMap = updownTypeList.stream().collect(Collectors.toMap(WarehouseUpdownTypeEntity::getAllocationId, Function.identity()));
List<Long> toNullUpdownTypeIds = new ArrayList<>();
List<Long> updateAllocationIds = new ArrayList<>();
List<WarehouseTaryAllocationEntity> deleteTrayAllocationList = new ArrayList<>();
List<WarehouseUpdownTypeEntity> updateUpdownTypeList = new ArrayList<>();
List<WarehouseUpdownGoodsLogEntity> updownGoodsLogEntities = new ArrayList<>();
List<DistributionParcelListEntity> updownParcelEntities = new ArrayList<>();
map.keySet().forEach(allocationId -> {
QueryWrapper<WarehouseTaryAllocationEntity> taryAllocationEntityQueryWrapper = new QueryWrapper<>(); QueryWrapper<WarehouseTaryAllocationEntity> taryAllocationEntityQueryWrapper = new QueryWrapper<>();
taryAllocationEntityQueryWrapper.eq("allocation_id", allocationId) taryAllocationEntityQueryWrapper.eq("allocation_id", allocationId)
.eq("is_deleted", 0); .eq("is_deleted", 0);
WarehouseTaryAllocationEntity taryAllocationEntity = warehouseTaryAllocationService.getOne(taryAllocationEntityQueryWrapper); WarehouseTaryAllocationEntity taryAllocationEntity = warehouseTaryAllocationService.getOne(taryAllocationEntityQueryWrapper);
// BasicdataTrayEntity trayEntity = warehouseTaryAllocationService.getTrayByAllocationId(allocationId); List<WarehouseUpdownGoodsEntity> updownGoodsEntities1 = map.get(allocationId);
if (!Objects.isNull(taryAllocationEntity)) { List<String> orderPackageCodes = updownGoodsEntities1.stream().map(WarehouseUpdownGoodsEntity::getAssociationValue).collect(Collectors.toList());
//有托盘,托盘下托 if(!Objects.isNull(taryAllocationEntity)){
warehouseTrayTypeService.downPackageByOrderPackageCode(orderPackageCode, remark + ":同步下托", warehouseId); warehouseTrayTypeService.downPackageByOrderPackageCodeList(orderPackageCodes, remark, warehouseId);
} }
Integer residue = warehouseUpdownGoodsService.deleteByUpdownGoodsId(updownGoodsId); WarehouseUpdownTypeEntity updownTypeEntity = updownTypeMap.get(allocationId);
Long updownTypeId = updownTypeEntity.getId();
//把updownGoodsEntities1的id提取到List中
List<Long> updownGoodsIds = updownGoodsEntities1.stream().map(WarehouseUpdownGoodsEntity::getId).collect(Collectors.toList());
Integer residue = warehouseUpdownGoodsService.deleteByUpdownGoodsIds(updownGoodsIds, updownTypeEntity.getId());
if (residue == 0) { if (residue == 0) {
//删除上架方式 //删除上架方式
removeById(updownTypeId); toNullUpdownTypeIds.add(updownTypeId);
//修改库位状态为空闲 //修改库位状态为空闲
basicdataGoodsAllocationClient.updateAllocationStatus(allocationId, "1"); updateAllocationIds.add(allocationId);
// basicdataGoodsAllocationClient.updateAllocationStatus(allocationId, "1");
//如果有托盘还要删除托盘与库位的绑定 //如果有托盘还要删除托盘与库位的绑定
if (!Objects.isNull(taryAllocationEntity)) { if (!Objects.isNull(taryAllocationEntity)) {
warehouseTaryAllocationService.deleteById(taryAllocationEntity); deleteTrayAllocationList.add(taryAllocationEntity);
// warehouseTaryAllocationService.deleteById(taryAllocationEntity);
} }
}else{
updateUpdownTypeList.add(updownTypeEntity);
} }
warehouseUpdownGoodsLogService.saveAllocationAndPackage(updownTypeEntity, parcelListEntity, "2", 0, remark + ":包件下架");
updatePackageGroundingStatus(orderPackageCode, "10", warehouseId); List<DistributionParcelListEntity> parcelListEntities = new ArrayList<>();
updateUpdownTypeNum(updownTypeEntity); orderPackageCodes.forEach(orderPackageCode -> {
orderSet.add(orderCode); DistributionParcelListEntity parcelListEntity = parcelListEntityMap.get(orderPackageCode);
num = num + quantity; if(!Objects.isNull(parcelListEntity)){
parcelListEntities.add(parcelListEntity);
}
});
parcelListEntities.forEach(parcelListEntity -> {
orderSet.add(parcelListEntity.getOrderCode());
WarehouseUpdownGoodsLogEntity warehouseUpdownGoodsLogEntity = new WarehouseUpdownGoodsLogEntity();
warehouseUpdownGoodsLogEntity.setCreateUser(1714696768639311873L);
warehouseUpdownGoodsLogEntity.setUpdateUser(1714696768639311873L);
warehouseUpdownGoodsLogEntity.setCreateDept(1649331096241836033L);
warehouseUpdownGoodsLogEntity.setTenantId(TenantNum.HUITONGCODE);
warehouseUpdownGoodsLogEntity.setUpdownTypeId(updownTypeEntity.getId());
warehouseUpdownGoodsLogEntity.setAreaId(updownTypeEntity.getAreaId());
warehouseUpdownGoodsLogEntity.setAreaTitle(updownTypeEntity.getAreaTitle());
warehouseUpdownGoodsLogEntity.setShelfId(updownTypeEntity.getShelfId());
warehouseUpdownGoodsLogEntity.setShelfTitle(updownTypeEntity.getShelfTitle());
warehouseUpdownGoodsLogEntity.setAllocationId(updownTypeEntity.getAllocationId());
warehouseUpdownGoodsLogEntity.setAllocationTitle(updownTypeEntity.getAllocationTitle());
warehouseUpdownGoodsLogEntity.setPositionCode(updownTypeEntity.getPositionCode());
warehouseUpdownGoodsLogEntity.setBindingType("2");
warehouseUpdownGoodsLogEntity.setIsAlltrays(0);
warehouseUpdownGoodsLogEntity.setAssociationId(parcelListEntity.getId());
warehouseUpdownGoodsLogEntity.setAssociationValue(parcelListEntity.getOrderPackageCode());
warehouseUpdownGoodsLogEntity.setAssociationType("3");
warehouseUpdownGoodsLogEntity.setNum(1);
warehouseUpdownGoodsLogEntity.setRemark(remark);
warehouseUpdownGoodsLogEntity.setWarehouseId(updownTypeEntity.getWarehouseId());
updownGoodsLogEntities.add(warehouseUpdownGoodsLogEntity);
parcelListEntity.setOrderPackageGroundingStatus("10");
});
updownParcelEntities.addAll(parcelListEntities);
});
removeByIds(toNullUpdownTypeIds);
basicdataGoodsAllocationClient.updateListAllocationStatus(updateAllocationIds,"1");
warehouseTaryAllocationService.removeBatchByIds(deleteTrayAllocationList);
updateUpdownTypeList.forEach(this::updateUpdownTypeNum);
warehouseUpdownGoodsLogService.saveBatch(updownGoodsLogEntities);
distributionParcelListClient.updateList(updownParcelEntities);
map.keySet().forEach(allocationId -> {
warehouseGoodsAllocationClient.updateAllocationCache(allocationId.toString()); warehouseGoodsAllocationClient.updateAllocationCache(allocationId.toString());
} });
for (String orderCode : orderSet) { for (String orderCode : orderSet) {
distributionStockArticleClient.updateOrderInfo(orderCode, warehouseId); distributionStockArticleClient.updateOrderInfo(orderCode, warehouseId);
} }
num = num + updownParcelEntities.size();
return Resp.scanSuccess("下架成功", "成功下架" + num + "件"); return Resp.scanSuccess("下架成功", "成功下架" + num + "件");
} }
@ -2961,6 +3045,37 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
} }
private void upShelfPackageListNoTray(List<DistributionParcelListEntity> parcelListEntities, BasicdataGoodsAllocationEntity goodsAllocationEntity, BasicdataGoodsShelfEntity goodsShelfEntity, BasicdataGoodsAreaEntity goodsAreaEntity, Long warehouseId, String remrk) {
log.info("###########upShelfPackageNoTray: 上架包件没有托盘 parcelListEntities={} allocationCode={}", parcelListEntities, goodsAllocationEntity.getGoodsAllocationName());
//修改上架方式的数量
QueryWrapper<WarehouseUpdownTypeEntity> updownTypeEntityQueryWrapper = new QueryWrapper<>();
updownTypeEntityQueryWrapper.eq("allocation_id", goodsAllocationEntity.getId())
.eq("is_deleted", 0);
WarehouseUpdownTypeEntity updownTypeEntity = baseMapper.selectOne(updownTypeEntityQueryWrapper);
if (Objects.isNull(updownTypeEntity)) {
updownTypeEntity = createUpdownType("1", goodsAllocationEntity, goodsShelfEntity, goodsAreaEntity, warehouseId);
}
Long wid = updownTypeEntity.getWarehouseId();
if (!wid.equals(warehouseId)) {
log.warn("##############upShelfPackageNoTray: 库位不在当前仓库 wid={}", wid);
throw new CustomerException(403, "库位不在当前仓库");
}
//货物和库位绑定
warehouseUpdownGoodsService.bindingAllocationAndPackageList(updownTypeEntity, parcelListEntities, "1", 0, remrk);
distributionParcelListClient.updateList(parcelListEntities);
//修改上架方式上的数据
updateUpdownTypeNum(updownTypeEntity);
}
private void updateUpdownTypeNum(WarehouseUpdownTypeEntity updownTypeEntity) { private void updateUpdownTypeNum(WarehouseUpdownTypeEntity updownTypeEntity) {
Long updownTypeId = updownTypeEntity.getId(); Long updownTypeId = updownTypeEntity.getId();
Long warehouseId = updownTypeEntity.getWarehouseId(); Long warehouseId = updownTypeEntity.getWarehouseId();

Loading…
Cancel
Save