Browse Source

1.老系统推送新增托盘接口逻辑优化

single_db
zhenghaoyu 1 year ago
parent
commit
c318aa9c9e
  1. 3
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataTrayClient.java
  2. 2
      blade-service-api/logpm-old-project-api/src/main/java/com/logpm/oldproject/feign/ITrayClient.java
  3. 8
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataTrayClient.java
  4. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/feign/TrayClient.java
  5. 2
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.java
  6. 6
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.xml
  7. 1
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/ITrayService.java
  8. 5
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/TrayServiceImpl.java
  9. 6
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java
  10. 4
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/dto/TrayInfoDTO.java
  11. 42
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/AsyncDataServiceImpl.java

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

@ -69,5 +69,6 @@ public interface IBasicdataTrayClient {
@GetMapping(GETTRAYENTITYLIST)
List<BasicdataTrayEntity> getTrayEntityList();
@GetMapping(API_PREFIX+"/getTrayByTrayNo")
BasicdataTrayEntity getTrayByTrayNo(@RequestParam String trayNo);
}

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

@ -43,6 +43,8 @@ public interface ITrayClient {
@GetMapping(API_PREFIX+"/getTrayById")
TrayEntity getTrayById(@RequestParam Integer trayId);
@GetMapping(API_PREFIX+"/getTrayByTrayNo")
TrayEntity getTrayByTrayNo(@RequestParam String trayNo);
// @GetMapping(API_PREFIX + "/getOrderByOrderSelfNum")

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

@ -101,4 +101,12 @@ public class BasicdataTrayClient implements IBasicdataTrayClient {
return basicdataTrayService.list();
}
@Override
public BasicdataTrayEntity getTrayByTrayNo(String trayNo) {
QueryWrapper<BasicdataTrayEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("pallet_name",trayNo)
.eq("is_deleted",0);
return basicdataTrayService.getOne(queryWrapper);
}
}

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

@ -24,4 +24,9 @@ public class TrayClient implements ITrayClient{
public TrayEntity getTrayById(Integer trayId) {
return trayService.getTrayById(trayId);
}
@Override
public TrayEntity getTrayByTrayNo(String trayNo) {
return trayService.getTrayByTrayNo(trayNo);
}
}

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

@ -3,7 +3,9 @@ package com.logpm.oldproject.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.oldproject.entity.TrayEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
@Mapper
public interface TrayMapper extends BaseMapper<TrayEntity> {
TrayEntity getTrayByTrayNo(@Param("trayNo") String trayNo);
}

6
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/TrayMapper.xml

@ -2,4 +2,10 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.oldproject.mapper.TrayMapper">
<select id="getTrayByTrayNo" resultType="com.logpm.oldproject.entity.TrayEntity">
select *
from ht_tray
where tray_no = #{trayNo}
</select>
</mapper>

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

@ -11,4 +11,5 @@ public interface ITrayService {
TrayEntity getTrayById(Integer trayId);
TrayEntity getTrayByTrayNo(String trayNo);
}

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

@ -28,4 +28,9 @@ public class TrayServiceImpl implements ITrayService {
public TrayEntity getTrayById(Integer trayId) {
return trayMapper.selectById(trayId);
}
@Override
public TrayEntity getTrayByTrayNo(String trayNo) {
return trayMapper.getTrayByTrayNo(trayNo);
}
}

6
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/controller/OldSystemPushController.java

@ -202,11 +202,11 @@ public class OldSystemPushController {
log.info("############addCreateTrayData: 请求参数{}",trayInfoDTO);
try{
Integer trayId = trayInfoDTO.getTrayId();
List<String> trayNos = trayInfoDTO.getTrayNos();
Integer warehouseId = trayInfoDTO.getWarehouseId();
if(Objects.isNull(trayId)){
log.warn("##############addCreateTrayData: 托盘id不存在 trayId={}",trayId);
if(trayNos.size() == 0){
log.warn("##############addCreateTrayData: 托盘id不存在 trayNos={}",trayNos);
return R.fail(405,"托盘id不存在");
}
if(Objects.isNull(warehouseId)){

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

@ -3,6 +3,8 @@ package com.logpm.warehouse.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
@Data
public class TrayInfoDTO implements Serializable {
@ -12,4 +14,6 @@ public class TrayInfoDTO implements Serializable {
private String orderPackageCode;
private Integer type;
private List<String> trayNos = new ArrayList<>();
}

42
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/AsyncDataServiceImpl.java

@ -473,7 +473,7 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
@Override
public void addCreateTrayData(TrayInfoDTO trayInfoDTO) {
Integer trayId = trayInfoDTO.getTrayId();
List<String> trayNos = trayInfoDTO.getTrayNos();
Integer oldWarehouseId = trayInfoDTO.getWarehouseId();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(oldWarehouseId);
@ -483,26 +483,30 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
}
Long warehouseId = basicdataWarehouseEntity.getId();
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
if(Objects.isNull(basicdataTrayEntity)){
log.info("############sendTrayInfoByOrderPackageCode: 托盘信息不存在 同步");
//如果托盘不存在就去同步该托盘
TrayEntity trayEntity = trayClient.getTrayById(trayId);
basicdataTrayEntity = new BasicdataTrayEntity();
basicdataTrayEntity.setTenantId("627683");
basicdataTrayEntity.setCreateUser(1714696768639311873L);
basicdataTrayEntity.setUpdateUser(1714696768639311873L);
basicdataTrayEntity.setCreateDept(1649331096241836033L);
basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
basicdataTrayEntity.setWarehouseId(warehouseId);
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
basicdataTrayEntity.setType(1);
basicdataTrayEntity.setOldId(trayId);
for (String trayNo : trayNos) {
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayNo(trayNo);
if(Objects.isNull(basicdataTrayEntity)){
log.info("############sendTrayInfoByOrderPackageCode: 托盘信息不存在 同步");
//如果托盘不存在就去同步该托盘
TrayEntity trayEntity = trayClient.getTrayByTrayNo(trayNo);
basicdataTrayEntity = new BasicdataTrayEntity();
basicdataTrayEntity.setTenantId("627683");
basicdataTrayEntity.setCreateUser(1714696768639311873L);
basicdataTrayEntity.setUpdateUser(1714696768639311873L);
basicdataTrayEntity.setCreateDept(1649331096241836033L);
basicdataTrayEntity.setPalletName(trayEntity.getTrayNo());
basicdataTrayEntity.setPalletCode("T"+trayEntity.getId());
basicdataTrayEntity.setWarehouseId(warehouseId);
basicdataTrayEntity.setTrayStatus(trayEntity.getStatus()+"");
basicdataTrayEntity.setType(1);
basicdataTrayEntity.setOldId(trayEntity.getId());
// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity);
basicdataTrayEntity.setId(aLong);
Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity);
basicdataTrayEntity.setId(aLong);
}
}
}
private void dealWithStockTray(String materialCode, String marketName, String incomingBatch, Integer stockNum, String trayCode, String trayType, Long warehouseId) {

Loading…
Cancel
Save