Browse Source

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

training
pref_mail@163.com 1 year ago
parent
commit
e140a9e36f
  1. 4
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayClient.java
  2. 3
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayScanClient.java
  3. 6
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/OrderStatusDTO.java
  4. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IFactoryCommonService.java
  5. 83
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java
  6. 9
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java
  7. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayClient.java
  8. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayScanClient.java
  9. 3
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayScanService.java
  10. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayService.java
  11. 10
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayScanServiceImpl.java
  12. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayServiceImpl.java

4
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayClient.java

@ -40,6 +40,10 @@ public interface ITrayClient {
@GetMapping(API_PREFIX+"/getAllTrayByWarehouseId")
List<TrayEntity> getAllTrayByWarehouseId(@RequestParam Integer oldWarehouseId);
@GetMapping(API_PREFIX+"/getTrayById")
TrayEntity getTrayById(@RequestParam Integer trayId);
// @GetMapping(API_PREFIX + "/getOrderByOrderSelfNum")
// List<OrderEntity> getOrderByOrderSelfNum(@RequestParam String orderSelfNum);

3
blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayScanClient.java

@ -16,6 +16,9 @@ public interface ITrayScanClient {
@GetMapping(API_PREFIX + "/getEntityByTrayScanId")
TrayScanEntity getEntityByTrayScanId(@RequestParam Integer trayScanId);
@GetMapping(API_PREFIX + "/getEntityByTrayIdAndOldWarehouseIdAndBindStatus")
TrayScanEntity getEntityByTrayIdAndOldWarehouseIdAndBindStatus(@RequestParam Integer trayId, @RequestParam String oldWarehouseId, @RequestParam Integer bindStatus);
// @GetMapping(API_PREFIX + "/getEntityByOrderCode")
// OrderCountEntity getEntityByOrderCode(@RequestParam String orderCode, @RequestParam Integer oldWarehouseId);

6
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/dto/OrderStatusDTO.java

@ -62,6 +62,12 @@ public class OrderStatusDTO implements Serializable {
@NotEmpty(message = "送货任务ID不能为空")
private String distributionContactId;
@NotEmpty(message = "托盘id")
private Integer trayId;
@NotEmpty(message = "托盘编码")
private Integer trayNo;
/**
* 验证参数是否都存在

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/IFactoryCommonService.java

@ -3,4 +3,6 @@ package com.logpm.factory.comfac.service;
public interface IFactoryCommonService {
void syncTrayTypeData(String unitNo, Integer trayId, String currentWarehouseId);
}

83
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java

@ -1,18 +1,101 @@
package com.logpm.factory.comfac.service.impl;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataTrayClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.oldproject.entity.TrayEntity;
import com.logpm.oldproject.entity.TrayScanEntity;
import com.logpm.oldproject.feign.ITrayClient;
import com.logpm.oldproject.feign.ITrayScanClient;
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.exception.CustomerException;
import org.springframework.stereotype.Service;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
@Slf4j
@Service
@AllArgsConstructor
public class FactoryCommonServiceImpl implements IFactoryCommonService {
private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final IBasicdataTrayClient basicdataTrayClient;
private final IWarehouseTrayTypeClient warehouseTrayTypeClient;
private final ITrayClient trayClient;
private final ITrayScanClient trayScanClient;
@Override
public void syncTrayTypeData(String unitNo, Integer trayId, String oldWarehouseId) {
//先判断新系统仓库信息是否存在
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(Integer.parseInt(oldWarehouseId));
if(Objects.isNull(warehouseEntity)){
log.error("###############syncTrayTypeData: 仓库信息不存在 oldWarehouseId={}",oldWarehouseId);
throw new CustomerException(403,"仓库信息不存在");
}
Long newWarehouseId = warehouseEntity.getId();
//判断托盘是否已经存在
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
if(Objects.isNull(basicdataTrayEntity)){
//如果托盘不存在就去同步该托盘
TrayEntity trayEntity = trayClient.getTrayById(trayId);
basicdataTrayEntity = new BasicdataTrayEntity();
basicdataTrayEntity.setTenantId("627683");
basicdataTrayEntity.setCreateUser(1649331096967450625L);
basicdataTrayEntity.setUpdateUser(1649331096967450625L);
basicdataTrayEntity.setCreateDept(1649331096241836033L);
basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
basicdataTrayEntity.setWarehouseId(newWarehouseId);
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
basicdataTrayEntity.setType(1);
basicdataTrayEntity.setOldId(trayId);
// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
basicdataTrayClient.addTray(basicdataTrayEntity);
}
//把包件打托到托盘上
TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayIdAndOldWarehouseIdAndBindStatus(trayId,oldWarehouseId,1);
String trayType = "100";
if(!Objects.isNull(trayScanEntity)){
Integer type = trayScanEntity.getType();
if(1==type){
trayType = "60";
}else if(2==type){
trayType = "30";
}else if(3==type){
trayType = "50";
}else if(4==type){
trayType = "100";
}else if(5==type){
trayType = "10";
}else if(6==type){
trayType = "20";
}
}
Map<String,Object> map = new HashMap<>();
map.put("trayType",trayType);
map.put("trayCode","T"+trayId);
map.put("warehouseId",newWarehouseId);
map.put("orderPackageCode",unitNo);
//新系统保存打托方式
boolean b = warehouseTrayTypeClient.orderScanOrderPackageCode(map);
if(!b){
log.error("################syncTrayTypeData: 包件打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId);
throw new CustomerException(403,"包件打托失败");
}
log.info("################syncTrayTypeData: 包件打托成功 unitNo={}",unitNo);
}
}

9
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java

@ -1,6 +1,7 @@
package com.logpm.factory.receiver;
import com.logpm.factory.comfac.dto.OrderStatusDTO;
import com.logpm.factory.comfac.service.IFactoryCommonService;
import com.logpm.factory.pan.service.IPanFactoryDataService;
import com.logpm.oldproject.feign.IAdvanceDetailClient;
import com.rabbitmq.client.Channel;
@ -16,6 +17,7 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import java.util.Map;
import java.util.Objects;
/**
@ -32,6 +34,8 @@ public class DealWithDataHandler {
private IAdvanceDetailClient advanceDetailClient;
@Autowired
private IPanFactoryDataService panFactoryDataService;
@Autowired
private IFactoryCommonService factoryCommonService;
private Integer retryCount = 1;
@ -43,6 +47,7 @@ public class DealWithDataHandler {
String status = orderStatusDTO.getStatus();
String unitNo = orderStatusDTO.getUnitNo();
String operationTime = orderStatusDTO.getOperationTime();
Integer trayId = orderStatusDTO.getTrayId();
if ("4".equals(status)) {
//继续判断是否到达目的仓
String currentWarehouseId = orderStatusDTO.getCurrentWarehouse();//当前仓Id
@ -64,6 +69,10 @@ public class DealWithDataHandler {
//真正的处理需要的数据
try {
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
//同步打托数据
if(!Objects.isNull(trayId)){
factoryCommonService.syncTrayTypeData(unitNo,trayId,currentWarehouseId);
}
} catch (Exception e) {
e.printStackTrace();
}

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayClient.java

@ -19,4 +19,9 @@ public class TrayClient implements ITrayClient{
public List<TrayEntity> getAllTrayByWarehouseId(Integer oldWarehouseId) {
return trayService.getAllByWarehouseId(oldWarehouseId);
}
@Override
public TrayEntity getTrayById(Integer trayId) {
return trayService.getTrayById(trayId);
}
}

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayScanClient.java

@ -17,4 +17,9 @@ public class TrayScanClient implements ITrayScanClient {
public TrayScanEntity getEntityByTrayScanId(Integer trayScanId) {
return trayScanService.getEntityByTrayScanId(trayScanId);
}
@Override
public TrayScanEntity getEntityByTrayIdAndOldWarehouseIdAndBindStatus(Integer trayId, String oldWarehouseId, Integer bindStatus) {
return trayScanService.getEntityByTrayIdAndOldWarehouseIdAndBindStatus(trayId,oldWarehouseId,bindStatus);
}
}

3
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayScanService.java

@ -4,4 +4,7 @@ import com.logpm.oldproject.entity.TrayScanEntity;
public interface ITrayScanService {
TrayScanEntity getEntityByTrayScanId(Integer trayScanId);
TrayScanEntity getEntityByTrayIdAndOldWarehouseIdAndBindStatus(Integer trayId, String oldWarehouseId, Integer bindStatus);
}

2
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayService.java

@ -9,4 +9,6 @@ public interface ITrayService {
List<TrayEntity> getAllByWarehouseId(Integer warehouseId);
TrayEntity getTrayById(Integer trayId);
}

10
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayScanServiceImpl.java

@ -1,5 +1,6 @@
package com.logpm.oldproject.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.oldproject.entity.TrayScanEntity;
import com.logpm.oldproject.mapper.TrayScanMapper;
import com.logpm.oldproject.service.ITrayScanService;
@ -16,4 +17,13 @@ public class TrayScanServiceImpl implements ITrayScanService {
public TrayScanEntity getEntityByTrayScanId(Integer trayScanId) {
return trayScanMapper.selectById(trayScanId);
}
@Override
public TrayScanEntity getEntityByTrayIdAndOldWarehouseIdAndBindStatus(Integer trayId, String oldWarehouseId, Integer bindStatus) {
QueryWrapper<TrayScanEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("tray_id",trayId)
.eq("warehouse_id",oldWarehouseId)
.eq("bind_status",bindStatus);
return trayScanMapper.selectOne(queryWrapper);
}
}

5
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayServiceImpl.java

@ -23,4 +23,9 @@ public class TrayServiceImpl implements ITrayService {
return trayMapper.selectList(queryWrapper);
}
@Override
public TrayEntity getTrayById(Integer trayId) {
return trayMapper.selectById(trayId);
}
}

Loading…
Cancel
Save