|
|
|
@ -770,9 +770,9 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
List<FactoryOrderEntity> factoryOrderEntities = factoryOrderService.lambdaQuery().eq(FactoryOrderEntity::getReceivingId, receivingOrderEntity.getId()).eq(FactoryOrderEntity::getTurnStatus, 0).list(); |
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>handlerOuPaiDataToHt 派车单 {} 派车单下面订单集合长度 {}", receivingOrderEntity.getCode(), factoryOrderEntities.size()); |
|
|
|
|
|
|
|
|
|
// addAdvanceEntityBtOuPai(receivingOrderEntity, factoryOrderEntities);
|
|
|
|
|
addAdvanceEntityBtOuPai(receivingOrderEntity, factoryOrderEntities); |
|
|
|
|
// TODO 走新系统暂存单,暂时不写后面再写
|
|
|
|
|
addAdvanceEntityBtOuPaiNew(receivingOrderEntity, factoryOrderEntities); |
|
|
|
|
// addAdvanceEntityBtOuPaiNew(receivingOrderEntity, factoryOrderEntities);
|
|
|
|
|
receivingOrderEntity.setTurnStatus(1); |
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>handlerOuPaiDataToHt 更新收货单状态 收货单号 {}", receivingOrderEntity.getCode()); |
|
|
|
|
receivingOrderService.updateById(receivingOrderEntity); |
|
|
|
@ -881,149 +881,6 @@ public class AsyncDataServiceImpl implements IAsyncDataService {
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
private void addAdvanceEntityBtOuPaiNew(ReceivingOrderEntity receivingOrderEntity, List<FactoryOrderEntity> factoryOrderEntities) { |
|
|
|
|
log.info(">>>>>>>>>>>>>>>>>>>>>>>>>>> addAdvanceEntityBtOuPai 派车单数据推送到新系统,更新物料信息 单号{}", receivingOrderEntity.getCode()); |
|
|
|
|
String carNumber = receivingOrderEntity.getCarNumber(); |
|
|
|
|
// 欧派只更新物料信息 不管暂存单信息
|
|
|
|
|
String fromWarehouseName = receivingOrderEntity.getFromWarehouseName(); |
|
|
|
|
// 只处理 已配置的基地的数据 其他基地无法确认,暂时不处理
|
|
|
|
|
Long startWarehouseId = null; |
|
|
|
|
String startWarehouseName = null; |
|
|
|
|
String tenantId = null; |
|
|
|
|
// 获取工厂基地绑定的始发仓信息
|
|
|
|
|
R<FactoryWarehouseBindVO> warehouseByBrandAndSiteName = factoryDataBaseClient.getWarehouseByBrandAndSiteName(BrandEnums.OP.getValue(), fromWarehouseName); |
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.equal(HttpConstants.HTTP.HTTP_RESOURCE_CODE.SUCCESS_CODE, warehouseByBrandAndSiteName.getCode())) { |
|
|
|
|
FactoryWarehouseBindVO data = warehouseByBrandAndSiteName.getData(); |
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.isNotNull(data)) { |
|
|
|
|
startWarehouseId = data.getWarehouseId(); |
|
|
|
|
startWarehouseName = data.getWarehouseName(); |
|
|
|
|
tenantId = data.getTenantId(); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.isAllNotEmpty(startWarehouseId, startWarehouseName, tenantId)) { |
|
|
|
|
// 订单
|
|
|
|
|
List<JSONObject> advances = new ArrayList<>(); |
|
|
|
|
for (FactoryOrderEntity factoryOrderEntity : factoryOrderEntities) { |
|
|
|
|
factoryOrderEntity.setTurnStatus(1); |
|
|
|
|
|
|
|
|
|
TrunklineAdvanceEntity advanceEntity = new TrunklineAdvanceEntity(); |
|
|
|
|
advanceEntity.setTenantId(tenantId); |
|
|
|
|
advanceEntity.setStatus(0); |
|
|
|
|
advanceEntity.setIsDeleted(0); |
|
|
|
|
advanceEntity.setOrderType(factoryOrderEntity.getOrderType()); |
|
|
|
|
advanceEntity.setBrand(BrandEnums.OP.getValue()); |
|
|
|
|
advanceEntity.setSiteName(fromWarehouseName); |
|
|
|
|
advanceEntity.setArea(""); |
|
|
|
|
advanceEntity.setPackName(""); |
|
|
|
|
advanceEntity.setPackCode(""); |
|
|
|
|
advanceEntity.setWarehouseId(startWarehouseId); |
|
|
|
|
advanceEntity.setWarehouseName(startWarehouseName); |
|
|
|
|
advanceEntity.setIsGcp(0); |
|
|
|
|
advanceEntity.setCarrierName("汇通物流"); |
|
|
|
|
advanceEntity.setSystemType("线上"); |
|
|
|
|
advanceEntity.setMatingType("1"); |
|
|
|
|
advanceEntity.setWaybillStatus("0"); |
|
|
|
|
advanceEntity.setWaybillNo(""); |
|
|
|
|
advanceEntity.setTrainNumber(receivingOrderEntity.getCarNumber()); |
|
|
|
|
advanceEntity.setFreezeStatus("0"); |
|
|
|
|
|
|
|
|
|
advanceEntity.setSenderFactory(""); |
|
|
|
|
advanceEntity.setOrderCode(factoryOrderEntity.getSelfCode()); |
|
|
|
|
advanceEntity.setDealerCode(factoryOrderEntity.getShopCode()); |
|
|
|
|
advanceEntity.setDealerName(factoryOrderEntity.getShopName()); |
|
|
|
|
advanceEntity.setStoreCode(factoryOrderEntity.getShopCode()); |
|
|
|
|
advanceEntity.setStoreName(factoryOrderEntity.getShopName()); |
|
|
|
|
advanceEntity.setServiceNum(factoryOrderEntity.getServiceNumber()); |
|
|
|
|
advanceEntity.setCustomerName(factoryOrderEntity.getCustomer()); |
|
|
|
|
advanceEntity.setCustomerPhone(factoryOrderEntity.getCustomerPhone()); |
|
|
|
|
advanceEntity.setCustomerAddress(factoryOrderEntity.getCustomerAddress()); |
|
|
|
|
advanceEntity.setConsigneePerson(factoryOrderEntity.getShopReceiver()); |
|
|
|
|
// 处理订单下面的包件数据
|
|
|
|
|
List<FactoryPackageEntity> list = factoryPackageService.lambdaQuery() |
|
|
|
|
.eq(FactoryPackageEntity::getOrderId, factoryOrderEntity.getId()).eq(FactoryPackageEntity::getTurnStatus, 0).list(); |
|
|
|
|
advanceEntity.setHasPackage(CollUtil.isNotEmpty(list) ? 1 : 0); |
|
|
|
|
advanceEntity.setTotalNum(CollUtil.isNotEmpty(list) ? list.size() : 0); |
|
|
|
|
List<JSONObject> packageList = new ArrayList<>(); |
|
|
|
|
for (FactoryPackageEntity factoryPackageEntity : list) { |
|
|
|
|
TrunklineAdvanceDetailEntity advanceDetailEntity = new TrunklineAdvanceDetailEntity(); |
|
|
|
|
advanceDetailEntity.setWarehouseId(startWarehouseId); |
|
|
|
|
advanceDetailEntity.setWarehouseName(startWarehouseName); |
|
|
|
|
advanceDetailEntity.setOrderCode(factoryOrderEntity.getSelfCode()); |
|
|
|
|
advanceDetailEntity.setBrand(BrandEnums.OP.getValue()); |
|
|
|
|
advanceDetailEntity.setSystemType("线上"); |
|
|
|
|
advanceDetailEntity.setFirstPackName(factoryPackageEntity.getFirstClassName()); |
|
|
|
|
advanceDetailEntity.setFirstPackCode(factoryPackageEntity.getFirstClassCode()); |
|
|
|
|
advanceDetailEntity.setSecondPackName(factoryPackageEntity.getSecondClassName());//二级品类名称
|
|
|
|
|
advanceDetailEntity.setSecondPackCode(factoryPackageEntity.getSecondClassCode());//二级品类
|
|
|
|
|
advanceDetailEntity.setThirdPackName(factoryPackageEntity.getThirdClassName());//三级品类名称
|
|
|
|
|
advanceDetailEntity.setThirdPackCode(factoryPackageEntity.getThirdClassCode());//三级品类
|
|
|
|
|
advanceDetailEntity.setMaterialName(factoryPackageEntity.getPackageDetailNames()); |
|
|
|
|
advanceDetailEntity.setSiteName(fromWarehouseName); |
|
|
|
|
advanceDetailEntity.setSiteCode(""); |
|
|
|
|
advanceDetailEntity.setQuantity(1); |
|
|
|
|
advanceDetailEntity.setOrderPackageCode(factoryPackageEntity.getCode()); |
|
|
|
|
advanceDetailEntity.setTrainNumber(receivingOrderEntity.getCarNumber()); |
|
|
|
|
advanceDetailEntity.setServiceNum(factoryOrderEntity.getServiceNumber()); |
|
|
|
|
advanceDetailEntity.setWaybillNo(""); |
|
|
|
|
advanceDetailEntity.setPackageStatus("0"); |
|
|
|
|
advanceDetailEntity.setWeight(factoryPackageEntity.getWeight()); |
|
|
|
|
if (cn.hutool.core.util.ObjectUtil.isAllNotEmpty(factoryPackageEntity.getHeight(), factoryPackageEntity.getWidth(), factoryPackageEntity.getLength())) { |
|
|
|
|
advanceDetailEntity.setVolume(factoryPackageEntity.getHeight().multiply(factoryPackageEntity.getWidth()).multiply(factoryPackageEntity.getLength())); |
|
|
|
|
} |
|
|
|
|
advanceDetailEntity.setSupple(""); |
|
|
|
|
advanceDetailEntity.setManifest(""); |
|
|
|
|
advanceDetailEntity.setReturnNum(""); |
|
|
|
|
advanceDetailEntity.setSendDateStr(DateUtil.formatLocalDateTime(LocalDateTime.now())); |
|
|
|
|
advanceDetailEntity.setCarNumber(""); |
|
|
|
|
advanceDetailEntity.setGoodsMan(""); |
|
|
|
|
advanceDetailEntity.setTenantId(tenantId); |
|
|
|
|
advanceDetailEntity.setStatus(0); |
|
|
|
|
advanceDetailEntity.setIsDeleted(0); |
|
|
|
|
// 物料
|
|
|
|
|
List<FactoryPackageDetailEntity> factoryPackageDetailEntities = factoryPackageDetailService.lambdaQuery() |
|
|
|
|
.eq(FactoryPackageDetailEntity::getPackageId, factoryPackageEntity.getId()).list(); |
|
|
|
|
List<JSONObject> itemJsons = new ArrayList<>(); |
|
|
|
|
if (CollUtil.isNotEmpty(factoryPackageDetailEntities)) { |
|
|
|
|
for (FactoryPackageDetailEntity factoryPackageDetailEntity : factoryPackageDetailEntities) { |
|
|
|
|
if(cn.hutool.core.util.ObjectUtil.equal(factoryPackageEntity.getPackageDetailNames(),factoryPackageDetailEntity.getName())){ |
|
|
|
|
advanceDetailEntity.setMaterialCode(factoryPackageDetailEntity.getCode()); |
|
|
|
|
} |
|
|
|
|
TrunklineDetailProductEntity detailProductEntity = new TrunklineDetailProductEntity(); |
|
|
|
|
detailProductEntity.setTenantId(tenantId); |
|
|
|
|
detailProductEntity.setWarehouseId(startWarehouseId); |
|
|
|
|
detailProductEntity.setWarehouseName(startWarehouseName); |
|
|
|
|
detailProductEntity.setUnitNo(factoryPackageEntity.getCode()); |
|
|
|
|
detailProductEntity.setProductCode(factoryPackageDetailEntity.getCode()); |
|
|
|
|
detailProductEntity.setProductName(factoryPackageDetailEntity.getName()); |
|
|
|
|
detailProductEntity.setReserve1(factoryPackageDetailEntity.getType()); |
|
|
|
|
detailProductEntity.setReserve2(factoryPackageDetailEntity.getUnit()); |
|
|
|
|
detailProductEntity.setQuantity(1); |
|
|
|
|
detailProductEntity.setStatus(0); |
|
|
|
|
detailProductEntity.setIsDeleted(0); |
|
|
|
|
itemJsons.add(JSONUtil.parseObj(detailProductEntity)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
JSONObject entries = JSONUtil.parseObj(advanceDetailEntity); |
|
|
|
|
entries.set("items", itemJsons); |
|
|
|
|
packageList.add(entries); |
|
|
|
|
} |
|
|
|
|
JSONObject entries = JSONUtil.parseObj(advanceEntity); |
|
|
|
|
entries.set("details", JSONUtil.toJsonStr(packageList)); |
|
|
|
|
advances.add(entries); |
|
|
|
|
} |
|
|
|
|
factoryOrderService.updateBatchById(factoryOrderEntities); |
|
|
|
|
// 发送消息
|
|
|
|
|
if (CollUtil.isNotEmpty(advances)) { |
|
|
|
|
for (JSONObject advance : advances) { |
|
|
|
|
SendMsg sendMsg = SendMsg.builder().exchange(FactoryDataConstants.Mq.Exchanges.ADVANCE_ORDER_OUPAI) |
|
|
|
|
.routingKey(FactoryDataConstants.Mq.RoutingKeys.ADVANCE_ORDER).message(JSONUtil.toJsonStr(advance)).build(); |
|
|
|
|
factoryDataClient.sendMessage(sendMsg); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 保存包件数据-- 欧派 |
|
|
|
|
* |
|
|
|
|