Browse Source

Merge branch 'dev' into pre-production

master
zhenghaoyu 10 months ago
parent
commit
c4ee8245ca
  1. 6
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/SyncOldTrayTypeClient.java
  2. 7
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java
  3. 134
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseUpdownTypeServiceImpl.java

6
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/feign/SyncOldTrayTypeClient.java

@ -1,7 +1,7 @@
package com.logpm.warehouse.feign;
import com.logpm.warehouse.dto.TrayInfoDTO;
import com.logpm.warehouse.service.IAsyncDataService;
import com.logpm.warehouse.service.IWarehouseUpdownTypeService;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.RestController;
@ -12,7 +12,7 @@ import springfox.documentation.annotations.ApiIgnore;
@AllArgsConstructor
public class SyncOldTrayTypeClient implements ISyncOldTrayTypeClient{
private final IAsyncDataService asyncDataService;
private final IWarehouseUpdownTypeService warehouseUpdownTypeService;
@Override
public R budaOldTrayTypeData(String orderPackageCode, Integer trayId, Integer type, Integer oldWarehouseId) {
@ -24,7 +24,7 @@ public class SyncOldTrayTypeClient implements ISyncOldTrayTypeClient{
trayInfoDTO.setWarehouseId(oldWarehouseId);
try{
asyncDataService.sendTrayInfoByOrderPackageCode(trayInfoDTO);
warehouseUpdownTypeService.sendTrayInfoByOrderPackageCode(trayInfoDTO);
}catch (Exception e){
return R.fail(405,"打托失败");
}

7
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/IWarehouseUpdownTypeService.java

@ -1,10 +1,7 @@
package com.logpm.warehouse.service;
import com.alibaba.fastjson.JSONObject;
import com.logpm.warehouse.dto.UpShelfOrderDTO;
import com.logpm.warehouse.dto.UpShelfPackageDTO;
import com.logpm.warehouse.dto.UpShelfStockDTO;
import com.logpm.warehouse.dto.UpShelfZeroOrderDTO;
import com.logpm.warehouse.dto.*;
import com.logpm.warehouse.entity.WarehouseUpdownTypeEntity;
import com.logpm.warehouse.vo.*;
import org.springblade.core.mp.base.BaseService;
@ -90,4 +87,6 @@ public interface IWarehouseUpdownTypeService extends BaseService<WarehouseUpdown
List<String> orderUpshelfDetailByAllocationId(String orderCode, Long allocationId, Long warehouseId);
String findStockListAllocations(Long warehouseId, Long mallId, String sku);
void sendTrayInfoByOrderPackageCode(TrayInfoDTO trayInfoDTO);
}

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

@ -174,6 +174,140 @@ public class WarehouseUpdownTypeServiceImpl extends BaseServiceImpl<WarehouseUpd
return String.join(",",allocations);
}
@Override
public void sendTrayInfoByOrderPackageCode(TrayInfoDTO trayInfoDTO) {
Integer trayId = trayInfoDTO.getTrayId();
String orderPackageCode = trayInfoDTO.getOrderPackageCode();
Integer oldWarehouseId = trayInfoDTO.getWarehouseId();
Integer type = trayInfoDTO.getType();
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(oldWarehouseId);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("####################sendTrayInfoByOrderPackageCode: 仓库信息为空 basicdataWarehouseEntity={}",basicdataWarehouseEntity);
throw new CustomerException(405,"仓库信息为空");
}
Long newWarehouseId = basicdataWarehouseEntity.getId();
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId);
if(Objects.isNull(basicdataTrayEntity)){
log.info("############sendTrayInfoByOrderPackageCode: 托盘信息不存在 同步");
throw new CustomerException(405,"托盘信息不存在");
}
String newTrayType = "100";
if(1==type){
newTrayType = "60";
}else if(2==type){
newTrayType = "30";
}else if(3==type){
newTrayType = "50";
}else if(4==type){
newTrayType = "100";
}else if(5==type){
newTrayType = "10";
}else if(6==type){
newTrayType = "20";
}
//判断托盘是否有上架
Long allocationId = warehouseTaryAllocationService.getAllocationIdByTrayId(basicdataTrayEntity.getId());
if(Objects.isNull(allocationId)){
//没有上架就直接打托
R response = warehouseTrayTypeService.orderScanOrderPackageCodeSync(newTrayType,"T"+trayId,orderPackageCode,newWarehouseId);
int code = response.getCode();
String msg = response.getMsg();
if(code == 4001){
log.info("####################sendTrayInfoByOrderPackageCode: 包件已在当前托盘打托 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}else if(code == 4002){
log.info("####################sendTrayInfoByOrderPackageCode: 包件已在其他托盘打托 orderPackageCode={} ",orderPackageCode);
QueryWrapper<WarehouseTrayGoodsEntity> trayGoodsEntityQueryWrapper = new QueryWrapper<>();
trayGoodsEntityQueryWrapper.eq("association_value",orderPackageCode);
WarehouseTrayGoodsEntity trayGoodsEntity = warehouseTrayGoodsService.getOne(trayGoodsEntityQueryWrapper);
if(Objects.isNull(trayGoodsEntity)){
log.warn("####################sendTrayInfoByOrderPackageCode: 包件未打托 orderPackageCode={}",orderPackageCode);
}else{
String oldTrayCode = trayGoodsEntity.getTrayCode();
Long trayGoodsId = trayGoodsEntity.getId();
Long wid = trayGoodsEntity.getWarehouseId();
BasicdataTrayEntity oldTrayEntity = basicdataTrayClient.getTrayByTrayCode(oldTrayCode);
Long oldTrayId = oldTrayEntity.getId();
//判断托盘是否有上架
Long oldAllocationId = warehouseTaryAllocationService.getAllocationIdByTrayId(oldTrayId);
if (Objects.isNull(oldAllocationId)){
//没有上架
//直接解绑托盘
warehouseTrayGoodsService.deleteByTrayGoodsId(trayGoodsId,wid);
}else{
//有上架
//下架
List<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>();
UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO();
upShelfPackageDTO.setOrderPackageCode(orderPackageCode);
upShelfPackageList.add(upShelfPackageDTO);
downPackage(upShelfPackageList,wid);
}
}
R r = warehouseTrayTypeService.orderScanOrderPackageCodeSync(newTrayType,"T"+trayId,orderPackageCode,newWarehouseId);
int code1 = r.getCode();
if(code1 != 200){
log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
throw new CustomerException(code1,"二次打托失败");
}else{
log.info("####################orderStatusHandler: 二次打托成功 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}
}else if(code == 4003){
log.info("####################orderStatusHandler: 包件未打托已上架 orderPackageCode={} ",orderPackageCode);
QueryWrapper<WarehouseUpdownGoodsEntity> updownGoodsEntityQueryWrapper = new QueryWrapper<>();
updownGoodsEntityQueryWrapper.eq("association_value", orderPackageCode);
WarehouseUpdownGoodsEntity updownGoodsEntity = warehouseUpdownGoodsService.getOne(updownGoodsEntityQueryWrapper);
if(Objects.isNull(updownGoodsEntity)){
log.warn("####################orderStatusHandler: 包件未上架 orderPackageCode={}",orderPackageCode);
}else{
Long wid = updownGoodsEntity.getWarehouseId();
List<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>();
UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO();
upShelfPackageDTO.setOrderPackageCode(orderPackageCode);
upShelfPackageList.add(upShelfPackageDTO);
downPackage(upShelfPackageList,wid);
}
R r = warehouseTrayTypeService.orderScanOrderPackageCodeSync(newTrayType, "T" + trayId, orderPackageCode, newWarehouseId);
int code1 = r.getCode();
if(code1 != 200){
log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
throw new CustomerException(code1,"二次打托失败");
}else{
log.info("####################orderStatusHandler: 二次打托成功 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
}
}else if(code == 4004){
log.info("####################orderStatusHandler: 包件打托方式不正确 orderPackageCode={} ",orderPackageCode);
//先去空置托盘再打托
warehouseTrayTypeService.trayToNull("T"+trayId);
R r = warehouseTrayTypeService.orderScanOrderPackageCodeSync(newTrayType, "T" + trayId, orderPackageCode, newWarehouseId);
int code1 = r.getCode();
if(code1 != 200){
log.warn("####################orderStatusHandler: 二次打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
throw new CustomerException(code1,"二次打托失败");
}
}else{
log.warn("######################orderStatusHandler: 打托失败 msg={} code={}",msg,code);
log.warn("######################orderStatusHandler: 打托失败 orderPackageCode={} trayCode={}",orderPackageCode,"T"+trayId);
throw new CustomerException(code,"二次打托失败");
}
}else{
//有上架就上架
List<UpShelfPackageDTO> upShelfPackageList = new ArrayList<>();
UpShelfPackageDTO upShelfPackageDTO = new UpShelfPackageDTO();
upShelfPackageDTO.setOrderPackageCode(orderPackageCode);
upShelfPackageList.add(upShelfPackageDTO);
upShelfPackage(upShelfPackageList,allocationId,newWarehouseId);
}
}
private void packageChangeStockByAllocaton(WarehouseUpdownGoodsEntity one) {
//当前登录人选择的仓库

Loading…
Cancel
Save