|
|
|
@ -3,10 +3,8 @@ package com.logpm.trunkline.mq;
|
|
|
|
|
import cn.hutool.json.JSONArray; |
|
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineCarsLoadLineEntity; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineCarsLoadScanEntity; |
|
|
|
|
import com.logpm.trunkline.entity.TrunklineCarsOrderEntity; |
|
|
|
|
import com.logpm.trunkline.dto.InComingDTO; |
|
|
|
|
import com.logpm.trunkline.entity.*; |
|
|
|
|
import com.logpm.trunkline.service.*; |
|
|
|
|
import com.rabbitmq.client.Channel; |
|
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
@ -27,13 +25,14 @@ import java.util.*;
|
|
|
|
|
@RabbitListener(queues = RabbitConstant.OPEN_ORDER_LOAD_SCAN_QUEUE) |
|
|
|
|
public class OpenOrderToLoadListener { |
|
|
|
|
|
|
|
|
|
private final ITrunklineAdvanceService advanceService; |
|
|
|
|
private final ITrunklineAdvanceDetailService advanceDetailService; |
|
|
|
|
private final ITrunklineCarsLoadScanService carsLoadScanService; |
|
|
|
|
private final ITrunklineCarsLoadService carsLoadService; |
|
|
|
|
private final ITrunklineCarsOrderService carsOrderService; |
|
|
|
|
private final ITrunklineCarsLoadLineService carsLoadLineService; |
|
|
|
|
private final ITrunklineWaybillOrderService waybillOrderService; |
|
|
|
|
|
|
|
|
|
private final IInComingService inComingService; |
|
|
|
|
|
|
|
|
|
@RabbitHandler |
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@ -48,6 +47,7 @@ public class OpenOrderToLoadListener {
|
|
|
|
|
Set<Long> loadIds = new HashSet<>(); |
|
|
|
|
for (Object object : advanceIds) { |
|
|
|
|
Long advanceId = (Long) object; |
|
|
|
|
TrunklineAdvanceEntity advanceEntity = advanceService.getById(advanceId); |
|
|
|
|
List<TrunklineAdvanceDetailEntity> advanceDetailEntityList = advanceDetailService.findListByAdvanceId(advanceId); |
|
|
|
|
for (TrunklineAdvanceDetailEntity advanceDetailEntity : advanceDetailEntityList) { |
|
|
|
|
String orderPackageCode = advanceDetailEntity.getOrderPackageCode(); |
|
|
|
@ -61,7 +61,21 @@ public class OpenOrderToLoadListener {
|
|
|
|
|
carsLoadScanEntity.setIsSupple(1); |
|
|
|
|
carsLoadScanEntity.setLoadingAbnormal(0); |
|
|
|
|
carsLoadScanEntity.setUnloadAbnormal(0); |
|
|
|
|
String packageStatus = advanceDetailEntity.getPackageStatus(); |
|
|
|
|
if("0".equals(packageStatus)){ |
|
|
|
|
//未入库,强制入库
|
|
|
|
|
Long warehouseId = advanceDetailEntity.getWarehouseId(); |
|
|
|
|
InComingDTO inComingDTO = new InComingDTO(); |
|
|
|
|
inComingDTO.setOrderPackageCode(orderPackageCode); |
|
|
|
|
inComingDTO.setIncomingType(10); |
|
|
|
|
inComingDTO.setWarehouseId(warehouseId); |
|
|
|
|
inComingService.incomingPackage(inComingDTO); |
|
|
|
|
carsLoadScanEntity.setFromWarehouseId(warehouseId); |
|
|
|
|
}else{ |
|
|
|
|
carsLoadScanEntity.setFromWarehouseId(advanceDetailEntity.getIncomingWarehouseId()); |
|
|
|
|
} |
|
|
|
|
carsLoadScanService.updateById(carsLoadScanEntity); |
|
|
|
|
|
|
|
|
|
Long loadId = carsLoadScanEntity.getLoadId(); |
|
|
|
|
Long warehouseId = carsLoadScanEntity.getWarehouseId(); |
|
|
|
|
String warehouseName = carsLoadScanEntity.getWarehouseName(); |
|
|
|
@ -87,8 +101,8 @@ public class OpenOrderToLoadListener {
|
|
|
|
|
trunklineCarsOrderEntity.setLoadLineId(carsLoadLineEntity.getId()); |
|
|
|
|
trunklineCarsOrderEntity.setOrderCode(orderCode); |
|
|
|
|
trunklineCarsOrderEntity.setWaybillNo(waybillNo); |
|
|
|
|
Integer totalNum = waybillOrderService.findTotalNumByWaybillNoAndOrderCode(waybillId,orderCode); |
|
|
|
|
trunklineCarsOrderEntity.setTotalNum(totalNum); |
|
|
|
|
// Integer totalNum = waybillOrderService.findTotalNumByWaybillNoAndOrderCode(waybillId,orderCode);
|
|
|
|
|
trunklineCarsOrderEntity.setTotalNum(advanceEntity.getTotalNum()); |
|
|
|
|
trunklineCarsOrderEntity.setPlanNum(0); |
|
|
|
|
trunklineCarsOrderEntity.setIsCustomer("0"); |
|
|
|
|
trunklineCarsOrderEntity.setRealNum(0); |
|
|
|
|