12 changed files with 137 additions and 0 deletions
@ -1,18 +1,101 @@ |
|||||||
package com.logpm.factory.comfac.service.impl; |
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.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.AllArgsConstructor; |
||||||
import lombok.extern.slf4j.Slf4j; |
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.common.exception.CustomerException; |
||||||
import org.springframework.stereotype.Service; |
import org.springframework.stereotype.Service; |
||||||
|
|
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Objects; |
||||||
|
|
||||||
@Slf4j |
@Slf4j |
||||||
@Service |
@Service |
||||||
@AllArgsConstructor |
@AllArgsConstructor |
||||||
public class FactoryCommonServiceImpl implements IFactoryCommonService { |
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); |
||||||
|
} |
||||||
} |
} |
||||||
|
Loading…
Reference in new issue