Browse Source

1.同步库位信息逻辑修改

training
zhenghaoyu 1 year ago
parent
commit
778eba309b
  1. 2
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsShelfClient.java
  2. 8
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/feign/BasicdataGoodsShelfClient.java
  3. 1
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/LocationMapper.xml
  4. 3
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/CargoServiceImpl.java
  5. 3
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/LocationServiceImpl.java
  6. 1
      blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/service/impl/ShelfServiceImpl.java
  7. 32
      blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncWarehouseData.java

2
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/feign/IBasicdataGoodsShelfClient.java

@ -55,4 +55,6 @@ public interface IBasicdataGoodsShelfClient {
@GetMapping(API_PREFIX+"/getEntityById")
BasicdataGoodsShelfEntity getEntityByGoodsShelfId(@RequestParam("goodsShelfId") Long goodsShelfId);
@GetMapping(API_PREFIX+"/updateRowAndFloorByShelfId")
void updateRowAndFloorByShelfId(@RequestParam int maxFloor, @RequestParam int maxRow, @RequestParam Long newShelfId);
}

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

@ -65,4 +65,12 @@ public class BasicdataGoodsShelfClient implements IBasicdataGoodsShelfClient {
return basicdataGoodsShelfService.getById(goodsShelfId);
}
@Override
public void updateRowAndFloorByShelfId(int maxFloor, int maxRow, Long newShelfId) {
BasicdataGoodsShelfEntity goodsShelfEntity = basicdataGoodsShelfService.getById(newShelfId);
goodsShelfEntity.setRowNum(maxRow);
goodsShelfEntity.setStoreyNum(maxFloor);
basicdataGoodsShelfService.updateById(goodsShelfEntity);
}
}

1
blade-service/logpm-old-project/src/main/java/com/logpm/oldproject/mapper/LocationMapper.xml

@ -9,7 +9,6 @@
from ht_location l
where l.shelf_id = #{shelfId}
and l.delete_time = 0
and l.`status` = 1
</select>
</mapper>

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

@ -19,8 +19,7 @@ public class CargoServiceImpl implements ICargoService {
public List<CargoEntity> getAllByWarehouseId(Integer oldWarehouseId) {
QueryWrapper<CargoEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("warehouse_id",oldWarehouseId)
.eq("delete_time",0)
.eq("status",1);
.eq("delete_time",0);
return cargoMapper.selectList(queryWrapper);
}
}

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

@ -25,8 +25,7 @@ public class LocationServiceImpl implements ILocationService {
public List<LocationEntity> getAllByShelfId(Integer shelfId) {
QueryWrapper<LocationEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("shelf_id",shelfId)
.eq("delete_time",0)
.eq("status",1);
.eq("delete_time",0);
return locationMapper.selectList(queryWrapper);
}
}

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

@ -20,7 +20,6 @@ public class ShelfServiceImpl implements IShelfService {
public List<ShelfEntity> getAllByWarehouseIdAndCargoId(Integer cargoId) {
QueryWrapper<ShelfEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("cargo_id",cargoId)
.eq("status",1)
.eq("delete_time",0);
return shelfMapper.selectList(queryWrapper);
}

32
blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncWarehouseData.java

@ -66,6 +66,9 @@ public class SyncWarehouseData {
//通过老系统仓库id去查有哪些货区
List<CargoEntity> cargoEntityList = cargoClient.getAllByWarehouseId(oldWarehouseId);
Map<Integer,Integer> areaIsEmptyMap = new HashMap<>();
areaIsEmptyMap.put(1,1);
areaIsEmptyMap.put(0,2);
for (CargoEntity cargoEntity:cargoEntityList){
//货区数据存储
Integer cargoId = cargoEntity.getId();//老系统货区id
@ -76,7 +79,7 @@ public class SyncWarehouseData {
goodsAreaEntity.setCreateDept(1649331096241836033L);
goodsAreaEntity.setWarehouseId(newWarehouseId);
goodsAreaEntity.setHeadline(cargoEntity.getTitle());
goodsAreaEntity.setEnableStatus("1");
goodsAreaEntity.setEnableStatus(areaIsEmptyMap.get(cargoEntity.getStatus())+"");
goodsAreaEntity.setAreaType("2");
goodsAreaEntity.setOldId(cargoId);
Long newAreaId = basicdataGoodsAreaClient.addCargo(goodsAreaEntity);
@ -105,7 +108,7 @@ public class SyncWarehouseData {
goodsShelfEntity.setWarehouseId(newWarehouseId);
goodsShelfEntity.setWarehouseCode(warehouseEntity.getWarehouseCode());
goodsShelfEntity.setGoodsShelfStatus(2);
goodsShelfEntity.setEnableStatus(1);
goodsShelfEntity.setEnableStatus(shelfIsEmptyMap.get(shelfEntity.getStatus()));
goodsShelfEntity.setStoreyNum(storeyAndRow.get("storey"));
goodsShelfEntity.setRowNum(storeyAndRow.get("row"));
goodsShelfEntity.setRemarks("");
@ -115,14 +118,26 @@ public class SyncWarehouseData {
log.warn("#################saveAllocationData: 保存货架信息失败oldShelfId={},oldWarehouseId={}",oldShelfId,oldWarehouseId);
return false;
}else{
int maxFloor = 0;
int maxRow = 0;
//货位数据存储
Map<Integer,Integer> locationIsEmptyMap = new HashMap<>();
locationIsEmptyMap.put(1,2);
locationIsEmptyMap.put(0,1);
locationIsEmptyMap.put(1,1);
locationIsEmptyMap.put(0,2);
List<LocationEntity> locationEntities = locationClient.getAllByShelfId(oldShelfId);
// List<BasicdataGoodsAllocationEntity> newLocations = new ArrayList<>();
for (LocationEntity locationEntity:locationEntities){
Integer locationId = locationEntity.getId();
String title = locationEntity.getTitle();
String[] split = title.split("-");
int floor = Integer.parseInt(split[0]);
int row = Integer.parseInt(split[1]);
if(floor > maxFloor){
maxFloor = floor;
}
if(row > maxRow){
maxRow = row;
}
BasicdataGoodsAllocationEntity entity = new BasicdataGoodsAllocationEntity();
entity.setTenantId("627683");
entity.setId(locationId.longValue());
@ -133,11 +148,11 @@ public class SyncWarehouseData {
entity.setGoodsAllocationName(locationEntity.getTitle());
entity.setWarehouseId(newWarehouseId);
entity.setGoodsShelfId(newShelfId);
entity.setEnableStatus("1");
entity.setEnableStatus(locationIsEmptyMap.get(locationEntity.getStatus())+"");
entity.setAllocationStatus("1");
entity.setLayerNum(locationEntity.getFloor());
entity.setColumnNum(locationEntity.getRow());
entity.setQrCode(shelfEntity.getTitle()+"排"+locationEntity.getFloor()+"层"+locationEntity.getRow()+"列");
entity.setLayerNum(floor);
entity.setColumnNum(row);
entity.setQrCode(shelfEntity.getTitle()+"排"+floor+"层"+row+"列");
entity.setOldId(locationId);
Long newLocationId = basicdataGoodsAllocationClient.addLocation(entity);
if(Objects.isNull(newLocationId)){
@ -147,6 +162,7 @@ public class SyncWarehouseData {
log.info("#################saveAllocationData: 保存货位信息成功locationId={},oldWarehouseId={}",locationId,oldWarehouseId);
}
}
basicdataGoodsShelfClient.updateRowAndFloorByShelfId(maxFloor,maxRow,newShelfId);
}
}
}

Loading…
Cancel
Save