|
|
|
@ -1,5 +1,9 @@
|
|
|
|
|
package com.logpm.factory.receiver; |
|
|
|
|
|
|
|
|
|
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.constant.FactoryConstant; |
|
|
|
|
import com.logpm.factory.comfac.dto.OrderStatusDTO; |
|
|
|
|
import com.logpm.factory.mt.service.IMtFactoryDataService; |
|
|
|
@ -7,7 +11,16 @@ import com.logpm.factory.oupai.service.IOuPaiFactoryService;
|
|
|
|
|
import com.logpm.factory.pan.service.IPanFactoryDataService; |
|
|
|
|
import com.logpm.factory.zb.service.IZbFactoryDataService; |
|
|
|
|
import com.logpm.oldproject.entity.AdvanceEntity; |
|
|
|
|
import com.logpm.oldproject.entity.TrayEntity; |
|
|
|
|
import com.logpm.oldproject.entity.TrayScanDesEntity; |
|
|
|
|
import com.logpm.oldproject.entity.TrayScanEntity; |
|
|
|
|
import com.logpm.oldproject.feign.IAdvanceClient; |
|
|
|
|
import com.logpm.oldproject.feign.ITrayClient; |
|
|
|
|
import com.logpm.oldproject.feign.ITrayScanClient; |
|
|
|
|
import com.logpm.oldproject.feign.ITrayScanDesClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseTaryAllocationClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient; |
|
|
|
|
import com.logpm.warehouse.feign.IWarehouseUpdownTypeClient; |
|
|
|
|
import com.rabbitmq.client.Channel; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
import org.springblade.common.constant.RabbitConstant; |
|
|
|
@ -21,6 +34,7 @@ import org.springframework.stereotype.Component;
|
|
|
|
|
|
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.security.NoSuchAlgorithmException; |
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
import java.util.Objects; |
|
|
|
|
|
|
|
|
@ -47,6 +61,22 @@ public class OrderStatusHandler {
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private IOuPaiFactoryService ouPaiFactoryService; |
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseTrayTypeClient warehouseTrayTypeClient; |
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseUpdownTypeClient updownTypeClient; |
|
|
|
|
@Autowired |
|
|
|
|
private IWarehouseTaryAllocationClient taryAllocationClient; |
|
|
|
|
@Autowired |
|
|
|
|
private IBasicdataWarehouseClient basicdataWarehouseClient; |
|
|
|
|
@Autowired |
|
|
|
|
private IBasicdataTrayClient basicdataTrayClient; |
|
|
|
|
@Autowired |
|
|
|
|
private ITrayClient trayClient; |
|
|
|
|
@Autowired |
|
|
|
|
private ITrayScanDesClient trayScanDesClient; |
|
|
|
|
@Autowired |
|
|
|
|
private ITrayScanClient trayScanClient; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RabbitHandler |
|
|
|
@ -57,6 +87,7 @@ public class OrderStatusHandler {
|
|
|
|
|
log.info("##################orderStatusHandler: 处理扫码作业数据"); |
|
|
|
|
OrderStatusDTO orderStatusDTO = (OrderStatusDTO) map.get("messageData"); |
|
|
|
|
String orderSelfNum = orderStatusDTO.getOrderNo();//订单自编号
|
|
|
|
|
String unitNo = orderStatusDTO.getUnitNo(); |
|
|
|
|
//通过订单自编号去查询该条订单是属于哪个工厂
|
|
|
|
|
AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderSelfNum); |
|
|
|
|
if (Objects.isNull(advanceEntity)) { |
|
|
|
@ -111,5 +142,92 @@ public class OrderStatusHandler {
|
|
|
|
|
log.info("##################orderStatusHandler: 未知品牌 type={}", type); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String status = orderStatusDTO.getStatus(); |
|
|
|
|
if("2".equals(status)){ |
|
|
|
|
String currentWarehouse = orderStatusDTO.getCurrentWarehouse(); |
|
|
|
|
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(Integer.parseInt(currentWarehouse)); |
|
|
|
|
if(Objects.isNull(basicdataWarehouseEntity)){ |
|
|
|
|
log.warn("####################orderStatusHandler: 仓库信息为空 basicdataWarehouseEntity={}",basicdataWarehouseEntity); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Long warehouseId = basicdataWarehouseEntity.getId(); |
|
|
|
|
Integer oldId = basicdataWarehouseEntity.getOldId(); |
|
|
|
|
|
|
|
|
|
Integer trayId = orderStatusDTO.getTrayId(); |
|
|
|
|
if(Objects.isNull(trayId)){ |
|
|
|
|
log.warn("####################orderStatusHandler: 托盘id为空 trayId={}",trayId); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayClient.getTrayByTrayCode("T" + trayId); |
|
|
|
|
if(Objects.isNull(basicdataTrayEntity)){ |
|
|
|
|
log.info("############syncTrayTypeData: 托盘信息不存在"); |
|
|
|
|
//如果托盘不存在就去同步该托盘
|
|
|
|
|
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); |
|
|
|
|
// basicdataTrayEntity.setNowWarehouseId(nowNewWarehouseId);
|
|
|
|
|
Long aLong = basicdataTrayClient.addTray(basicdataTrayEntity); |
|
|
|
|
basicdataTrayEntity.setId(aLong); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
TrayScanDesEntity trayScanDesEntity = trayScanDesClient.findScanTypeId(trayId, unitNo, oldId); |
|
|
|
|
if(Objects.isNull(trayScanDesEntity)){ |
|
|
|
|
log.warn("####################orderStatusHandler: 没有打托数据 trayId={}",trayId); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Integer trayScanId = trayScanDesEntity.getTrayScanId(); |
|
|
|
|
TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayScanId(trayScanId); |
|
|
|
|
if(Objects.isNull(trayScanEntity)){ |
|
|
|
|
log.warn("####################orderStatusHandler: 没有打托方式数据 trayScanId={}",trayScanId); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
Integer trayType = trayScanEntity.getType(); |
|
|
|
|
|
|
|
|
|
String newTrayType = "100"; |
|
|
|
|
if(1==trayType){ |
|
|
|
|
newTrayType = "60"; |
|
|
|
|
}else if(2==trayType){ |
|
|
|
|
newTrayType = "30"; |
|
|
|
|
}else if(3==trayType){ |
|
|
|
|
newTrayType = "50"; |
|
|
|
|
}else if(4==trayType){ |
|
|
|
|
newTrayType = "100"; |
|
|
|
|
}else if(5==trayType){ |
|
|
|
|
newTrayType = "10"; |
|
|
|
|
}else if(6==trayType){ |
|
|
|
|
newTrayType = "20"; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//判断托盘是否有上架
|
|
|
|
|
Long allocationId = taryAllocationClient.findAllocationByTrayId(basicdataTrayEntity.getId()); |
|
|
|
|
if(Objects.isNull(allocationId)){ |
|
|
|
|
//没有上架就直接打托
|
|
|
|
|
Map<String,Object> m = new HashMap<>(); |
|
|
|
|
m.put("trayType",newTrayType); |
|
|
|
|
m.put("trayCode","T"+trayId); |
|
|
|
|
m.put("warehouseId",warehouseId); |
|
|
|
|
m.put("orderPackageCode",unitNo); |
|
|
|
|
|
|
|
|
|
boolean b = warehouseTrayTypeClient.orderScanOrderPackageCode(m); |
|
|
|
|
if(!b){ |
|
|
|
|
log.warn("####################orderStatusHandler: 打托失败 unitNo={} trayCode={}",unitNo,"T"+trayId); |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
//有上架就上架
|
|
|
|
|
updownTypeClient.upShelfPackage(unitNo,allocationId,warehouseId); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|