|
|
|
@ -5,8 +5,6 @@ import cn.hutool.core.util.ObjectUtil;
|
|
|
|
|
import cn.hutool.core.util.StrUtil; |
|
|
|
|
import cn.hutool.json.JSONObject; |
|
|
|
|
import cn.hutool.json.JSONUtil; |
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.logpm.distribution.dto.ReportQualityDeliverDTO; |
|
|
|
|
import com.logpm.distribution.entity.QualityDeliverEntity; |
|
|
|
|
import com.logpm.distribution.service.IQualityDeliverService; |
|
|
|
@ -21,7 +19,6 @@ import org.springblade.common.enums.PackageTypeEnums;
|
|
|
|
|
import org.springblade.common.model.DistributionLoadVO; |
|
|
|
|
import org.springblade.common.model.NodeFanoutMsg; |
|
|
|
|
import org.springblade.common.model.PackageData; |
|
|
|
|
import org.springblade.common.model.StockUpVO; |
|
|
|
|
import org.springframework.amqp.core.ExchangeTypes; |
|
|
|
|
import org.springframework.amqp.rabbit.annotation.Exchange; |
|
|
|
|
import org.springframework.amqp.rabbit.annotation.Queue; |
|
|
|
@ -66,62 +63,50 @@ public class LoadingReportListener {
|
|
|
|
|
Object main = bean.getMain(); |
|
|
|
|
JSONObject entries = JSONUtil.parseObj(main); |
|
|
|
|
DistributionLoadVO vo = JSONUtil.toBean(entries, DistributionLoadVO.class); |
|
|
|
|
if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) { |
|
|
|
|
// 根据预约单号查询出所有这个预约单下的数据 先置空
|
|
|
|
|
LambdaUpdateWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaUpdate() |
|
|
|
|
.set(QualityDeliverEntity::getStockupCode, null) |
|
|
|
|
.set(QualityDeliverEntity::getStockupUserName, null) |
|
|
|
|
.set(QualityDeliverEntity::getStockupFinishTime, null) |
|
|
|
|
.set(QualityDeliverEntity::getStockNum, null) |
|
|
|
|
.set(QualityDeliverEntity::getStockAllocation, null) |
|
|
|
|
.set(QualityDeliverEntity::getStockupCreateTime, null) |
|
|
|
|
.ne(QualityDeliverEntity::getBizStatus, 110); |
|
|
|
|
qualityDeliverService.update(wrapper); |
|
|
|
|
} |
|
|
|
|
// if (BizOperationEnums.MODIFY.equals(bizOperation) || BizOperationEnums.DELETE.equals(bizOperation)) {
|
|
|
|
|
// // 根据预约单号查询出所有这个预约单下的数据 先置空
|
|
|
|
|
// LambdaUpdateWrapper<QualityDeliverEntity> wrapper = Wrappers.<QualityDeliverEntity>lambdaUpdate()
|
|
|
|
|
// .set(QualityDeliverEntity::getLoadUserName, null)
|
|
|
|
|
// .set(QualityDeliverEntity::getLoadTime, null)
|
|
|
|
|
// .set(QualityDeliverEntity::getLoadLicensePlate, null)
|
|
|
|
|
// .set(QualityDeliverEntity::getLoadNum, null)
|
|
|
|
|
// .ne(QualityDeliverEntity::getBizStatus, 110);
|
|
|
|
|
// qualityDeliverService.update(wrapper);
|
|
|
|
|
// }
|
|
|
|
|
if (CollUtil.isNotEmpty(details)) { |
|
|
|
|
for (PackageData detail : details) { |
|
|
|
|
QualityDeliverEntity qualityDeliverEntity = QualityDeliverEntity.builder() |
|
|
|
|
.warehouseName(bean.getWarehouse()) |
|
|
|
|
.warehouseId(warehouseId) |
|
|
|
|
.stockupUserName(bean.getOperator()) |
|
|
|
|
.stockupCreateTime(bean.getOperatorTime()) |
|
|
|
|
// 备货区 TODO
|
|
|
|
|
// .stockAllocation(vo.get)
|
|
|
|
|
.orderPackageCode(detail.getPackageCode()) |
|
|
|
|
.loadUserName(bean.getOperator()) |
|
|
|
|
.loadNum(detail.getNumber()) |
|
|
|
|
.loadTime(bean.getOperatorTime()) |
|
|
|
|
.loadLicensePlate(vo.getVehicleName()) |
|
|
|
|
.build(); |
|
|
|
|
if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.CMP)) { |
|
|
|
|
qualityDeliverEntity.setConditions(1); |
|
|
|
|
qualityDeliverEntity.setStockNum(1); |
|
|
|
|
if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { |
|
|
|
|
ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); |
|
|
|
|
factoryDataClient.sendMessage(SendMsg.builder() |
|
|
|
|
.exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) |
|
|
|
|
.routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) |
|
|
|
|
.message(JSONUtil.toJsonStr(dto)) |
|
|
|
|
.delay(3000) |
|
|
|
|
.build()); |
|
|
|
|
} |
|
|
|
|
qualityDeliverEntity.setLoadNum(1); |
|
|
|
|
sendReport(bizOperation, qualityDeliverEntity); |
|
|
|
|
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.LTL)) { |
|
|
|
|
qualityDeliverEntity.setOrderCode(detail.getOrderCode()); |
|
|
|
|
qualityDeliverEntity.setCostCategory(detail.getProductName()); |
|
|
|
|
qualityDeliverEntity.setRevenueCategory(detail.getProductName()); |
|
|
|
|
qualityDeliverEntity.setConditions(2); |
|
|
|
|
qualityDeliverEntity.setStockNum(detail.getNumber()); |
|
|
|
|
if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { |
|
|
|
|
ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); |
|
|
|
|
factoryDataClient.sendMessage(SendMsg.builder() |
|
|
|
|
.exchange(ReportConstants.REPORT_QUALITY_DELIVER_EXCHANGE) |
|
|
|
|
.routingKey(ReportConstants.REPORT_QUALITY_DELIVER_ROUTINGKEY) |
|
|
|
|
.message(JSONUtil.toJsonStr(dto)) |
|
|
|
|
.delay(3000) |
|
|
|
|
.build()); |
|
|
|
|
} |
|
|
|
|
sendReport(bizOperation, qualityDeliverEntity); |
|
|
|
|
} else if (ObjectUtil.equals(detail.getPackageType(), PackageTypeEnums.INV)) { |
|
|
|
|
qualityDeliverEntity.setIncomingBatch(detail.getPickupBatch()); |
|
|
|
|
qualityDeliverEntity.setMallName(detail.getMallName()); |
|
|
|
|
qualityDeliverEntity.setMaterielCode(detail.getMaterialCode()); |
|
|
|
|
qualityDeliverEntity.setMaterielName(detail.getMaterialName()); |
|
|
|
|
qualityDeliverEntity.setConditions(3); |
|
|
|
|
qualityDeliverEntity.setStockNum(detail.getNumber()); |
|
|
|
|
sendReport(bizOperation, qualityDeliverEntity); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void sendReport(BizOperationEnums bizOperation, QualityDeliverEntity qualityDeliverEntity) { |
|
|
|
|
if (BizOperationEnums.ADD.equals(bizOperation) || BizOperationEnums.MODIFY.equals(bizOperation)) { |
|
|
|
|
ReportQualityDeliverDTO dto = ReportQualityDeliverDTO.builder().data(JSONUtil.toJsonStr(qualityDeliverEntity)).operation(BizOperationEnums.MODIFY).build(); |
|
|
|
|
factoryDataClient.sendMessage(SendMsg.builder() |
|
|
|
@ -132,8 +117,5 @@ public class LoadingReportListener {
|
|
|
|
|
.build()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|