Browse Source

1.推送订单,运单明细添加

2.各仓同步订单逻辑优化
3.同步老系统打托数据,不能同步未开单的订单
pull/2/head
zhenghaoyu 11 months ago
parent
commit
51586195c7
  1. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  2. 4
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java
  3. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  4. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java
  5. 47
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java
  6. 40
      blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java
  7. 3
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java
  8. 143
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java
  9. 26
      blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

3
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java

@ -143,4 +143,7 @@ public interface IDistributionParcelListClient {
@GetMapping(API_PREFIX+"/findEntityListByOrderCodeAndStatus")
List<DistributionParcelListEntity> findEntityListByOrderCodeAndStatus(@RequestParam String orderCode, @RequestParam Long warehouseId, @RequestParam String packageStatus);
@GetMapping(API_PREFIX+"/getListByOrderPackageCode")
List<DistributionParcelListEntity> getListByOrderPackageCode(@RequestParam String orderPackageCode);
}

4
blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionStockArticleClient.java

@ -139,4 +139,8 @@ public interface IDistributionStockArticleClient {
@GetMapping(API_PREFIX + "/submitHandleNumAndTotalNumberByOrderId")
void submitHandleNumAndTotalNumberByOrderId(@RequestParam Integer subNum, @RequestParam Long articleId);
@GetMapping(API_PREFIX + "/findListByOrderCode")
List<DistributionStockArticleEntity> findListByOrderCode(@RequestParam String orderCode);
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java

@ -299,4 +299,12 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
public List<DistributionParcelListEntity> findEntityListByOrderCodeAndStatus(String orderCode, Long warehouseId, String packageStatus) {
return distributionParcelListService.findEntityListByOrderCodeAndStatus(orderCode,warehouseId,packageStatus);
}
@Override
public List<DistributionParcelListEntity> getListByOrderPackageCode(String orderPackageCode) {
QueryWrapper<DistributionParcelListEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_package_code",orderPackageCode);
return distributionParcelListService.list(queryWrapper);
}
}

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionStockArticleClient.java

@ -283,4 +283,12 @@ public class DistributionStockArticleClient implements IDistributionStockArticle
distributionStockArticleService.submitHandleNumAndTotalNumberByOrderId(subNum,articleId);
}
@Override
public List<DistributionStockArticleEntity> findListByOrderCode(String orderCode) {
QueryWrapper<DistributionStockArticleEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_code",orderCode);
return distributionStockArticleService.list(queryWrapper);
}
}

47
blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java

@ -9,9 +9,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.basic.entity.BasicMaterialEntity;
import com.logpm.basic.feign.IBasicMaterialClient;
import com.logpm.basicdata.entity.BasicdataCategoryEntity;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataStoreBusinessEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataCategoryClient;
import com.logpm.basicdata.feign.IBasicdataClientClient;
import com.logpm.basicdata.feign.IBasicdataStoreBusinessClient;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
@ -45,9 +47,11 @@ import com.logpm.trunkline.feign.ITrunklineAdvanceClient;
import com.logpm.trunkline.feign.ITrunklineAdvanceDetailClient;
import com.logpm.trunkline.feign.ITrunklineDetailProductClient;
import com.logpm.trunkline.feign.ITrunklineWaybillOrderClient;
import com.logpm.warehouse.entity.WarehouseWayBillDetail;
import com.logpm.warehouse.entity.WarehouseWaybillEntity;
import com.logpm.warehouse.feign.IWarehouseTrayTypeClient;
import com.logpm.warehouse.feign.IWarehouseWaybillClient;
import com.logpm.warehouse.feign.IWarehouseWaybillDetailClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -85,6 +89,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
private final IOrderDetailClient orderDetailClient;
private final IAdvanceClient advanceClient;
private final IWayBillClient wayBillClient;
private final IWaybillDesClient waybillDesClient;
private final IDistributionParcelListClient distributionParcelListClient;
private final IDistributionStockArticleClient distributionStockArticleClient;
@ -94,6 +99,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
private final IBasicdataWarehouseClient basicdataWarehouseClient;
private final IWarehouseWaybillClient warehouseWaybillClient;
private final IWarehouseWaybillDetailClient warehouseWaybillDetailClient;
private final IBasicMaterialClient basicMaterialClient;
@ -108,6 +114,7 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
private final IDetailProductClient detailProductClient;
private final ITrunklineDetailProductClient trunklineDetailProductClient;
private final ITrunklineAdvanceDetailClient trunklineAdvanceDetailClient;
private final IBasicdataCategoryClient categoryClient;
private final IOrderCountClient orderCountClient;
private final BladeRedis redis;
@ -890,7 +897,45 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
warehouseWaybill.setIsDeleted(0);
warehouseWaybill.setCreateTime(date);
warehouseWaybill.setUpdateTime(date);
warehouseWaybillClient.addEnntity(warehouseWaybill);
Long aLong = warehouseWaybillClient.addEnntity(warehouseWaybill);
if(aLong != 0){
List<WaybillDesEntity> desList = waybillDesClient.getDesList(waybillNo);
List<WarehouseWayBillDetail> warehouseWayBillDetails = new ArrayList<>();
for (WaybillDesEntity waybillDesEntity : desList) {
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail();
warehouseWayBillDetail.setCreateUser(1714696768639311873L);
warehouseWayBillDetail.setUpdateUser(1714696768639311873L);
warehouseWayBillDetail.setCreateDept(1649331096241836033L);
warehouseWayBillDetail.setWaybillId(aLong);
warehouseWayBillDetail.setWaybillNo(waybillNo);
String goodsName = waybillDesEntity.getName();
BasicdataCategoryEntity categoryEntity = categoryClient.findByName(goodsName);
if(Objects.isNull(categoryEntity)){
categoryEntity = new BasicdataCategoryEntity();
categoryEntity.setName(goodsName);
categoryEntity.setType(1);
categoryEntity.setTenantId(TenantNum.HUITONGCODE);
categoryEntity.setCreateUser(1714696768639311873L);
categoryEntity.setUpdateUser(1714696768639311873L);
categoryEntity.setCreateDept(1649331096241836033L);
Long categoryId = categoryClient.addReturnId(categoryEntity);
warehouseWayBillDetail.setProductId(categoryId);
}else{
warehouseWayBillDetail.setProductId(categoryEntity.getId());
}
warehouseWayBillDetail.setProductName(goodsName);
warehouseWayBillDetail.setNum(waybillDesEntity.getNum());
warehouseWayBillDetail.setPrice(waybillDesEntity.getPrice());
warehouseWayBillDetail.setVolume(waybillDesEntity.getVolume());
warehouseWayBillDetail.setWeight(waybillDesEntity.getWeight());
warehouseWayBillDetail.setSubtotalFreight(waybillDesEntity.getTotalDesPrice());
warehouseWayBillDetail.setChargeType(waybillDesEntity.getPic());
warehouseWayBillDetails.add(warehouseWayBillDetail);
}
warehouseWaybillDetailClient.addList(warehouseWayBillDetails);
}
} else {
warehouseWaybill.setStockCount(warehouseWaybill.getStockCount() + 1);
warehouseWaybill.setUpdateTime(new Date());

40
blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java

@ -35,10 +35,7 @@ import org.springblade.common.utils.CommonUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.*;
/**
* 同步老系统订单信息到新系统
@ -639,5 +636,40 @@ public class SyncOrderInfoToPlatform {
return ReturnT.SUCCESS;
}
@XxlJob("repairNoOpenOrderOrderInfo")
public ReturnT<String> repairNoOpenOrderOrderInfo(String param) {
log.info("############repairNoOpenOrderOrderInfo: 修复未开单订单信息 开始");
if(StringUtil.isBlank(param)){
log.warn("##############repairNoOpenOrderOrderInfo: 请输入需要修复的订单 ");
return ReturnT.FAIL;
}
List<String> orderCodes = new ArrayList<>();
if(param.contains(",")){
String[] split = param.split(",");
orderCodes = Arrays.asList(split);
}else{
orderCodes.add(param);
}
for (String orderCode : orderCodes) {
//查询新系统是否存在该订单
List<DistributionStockArticleEntity> stockArticleEntityList = distributionStockArticleClient.findListByOrderCode(orderCode);
if(stockArticleEntityList == null || stockArticleEntityList.size() == 0){
log.warn("#############repairNoOpenOrderOrderInfo: 未查询到新系统有订单信息");
continue;
}
syncOrderInfoService.repairNoOpenOrderOrderInfo(orderCode);
}
log.info("############repairNoOpenOrderOrderInfo: 修复未开单订单信息 完成");
return ReturnT.SUCCESS;
}
}

3
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java

@ -16,4 +16,7 @@ public interface ISyncOrderInfoService {
void handleDataAndInventoryId(List<String> orderCodeList, Integer oldWarehouseId, Long newWarehouseId, Integer inventoryId);
void syncUpdownData(Integer oldWarehouseId, Long newWarehouseId);
void repairNoOpenOrderOrderInfo(String orderCode);
}

143
blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java

@ -87,6 +87,7 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
private final BladeRedis redis;
private final IWarehouseMappingDataService warehouseMappingDataService;
private final IBasicdataCategoryClient categoryClient;
@Transactional(rollbackFor = Exception.class)
@Override
@ -199,6 +200,105 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
}
}
@Override
public void repairNoOpenOrderOrderInfo(String orderCode) {
List<AdvanceEntity> advanceList = advanceClient.getAdvanceList(orderCode);
Set<String> waybillNos = new HashSet<>();
for (AdvanceEntity advanceEntity : advanceList) {
Integer advanceId = advanceEntity.getId();
String waybillNo = advanceEntity.getWaybillNo();
String dealerCode = advanceEntity.getDealerCode();
String dealerName = advanceEntity.getDealerName();
saveWaybillEntity(waybillNo);
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
if(!Objects.isNull(warehouseWaybillEntity)){
Long departureWarehouseId = warehouseWaybillEntity.getDepartureWarehouseId();
String departureWarehouseName = warehouseWaybillEntity.getDepartureWarehouseName();
Long destinationWarehouseId = warehouseWaybillEntity.getDestinationWarehouseId();
String destinationWarehouseName = warehouseWaybillEntity.getDestinationWarehouseName();
Long waybillId = warehouseWaybillEntity.getId();
List<AdvanceDetailEntity> detailEntityList = advanceDetailClient.findListByAdvanceId(advanceId);
for (AdvanceDetailEntity advanceDetailEntity : detailEntityList) {
String orderPackageCode = advanceDetailEntity.getUnitNo();
List<DistributionParcelListEntity> parcelListEntityList = distributionParcelListClient.getListByOrderPackageCode(orderPackageCode);
for (DistributionParcelListEntity parcelListEntity : parcelListEntityList) {
Long warehouseId = parcelListEntity.getWarehouseId();
parcelListEntity.setWaybillId(waybillId+"");
parcelListEntity.setWaybillNumber(waybillNo);
parcelListEntity.setSendWarehouseId(departureWarehouseId);
parcelListEntity.setSendWarehouseName(departureWarehouseName);
parcelListEntity.setAcceptWarehouseId(destinationWarehouseId);
parcelListEntity.setAcceptWarehouseName(destinationWarehouseName);
parcelListEntity.setDealerCode(dealerCode);
parcelListEntity.setDealerName(dealerName);
if(warehouseId.equals(destinationWarehouseId)){
parcelListEntity.setIsTransfer(0);
}else{
parcelListEntity.setIsTransfer(1);
}
distributionParcelListClient.update(parcelListEntity);
}
}
}
waybillNos.add(waybillNo);
}
String waybillNumber = null;
String waybillNumberStr = null;
for (String waybillNo : waybillNos) {
if(StringUtil.isBlank(waybillNumber)){
waybillNumber = waybillNo;
}
if(StringUtil.isBlank(waybillNumberStr)){
waybillNumberStr = waybillNo;
}else{
waybillNumberStr = waybillNumberStr + "," + waybillNo;
}
}
if(StringUtil.isNotBlank(waybillNumber)){
WarehouseWaybillEntity newWaybill = warehouseWaybillClient.findByWaybillNo(waybillNumber);
String consignee = newWaybill.getConsignee();
String consigneeName = newWaybill.getConsigneeName();
String consigneeMobile = newWaybill.getConsigneeMobile();
String consigneeAddress = newWaybill.getConsigneeAddress();
BasicdataClientEntity clientEntity = basicdataClientClient.findByName(consignee);
String consigneeCode = null;
Long consigneeId = null;
String peisongType = "1";//默认商配
if(!Objects.isNull(clientEntity)){
consigneeId = clientEntity.getId();
consigneeCode = clientEntity.getClientCode();
consignee = clientEntity.getClientName();
peisongType = getPeisongTypeByClientId(consigneeId);
}
List<DistributionStockArticleEntity> stockArticleEntityList = distributionStockArticleClient.findListByOrderCode(orderCode);
for (DistributionStockArticleEntity stockArticleEntity : stockArticleEntityList) {
stockArticleEntity.setWaybillNumber(waybillNumberStr);
stockArticleEntity.setConsigneeUnit(consignee);
stockArticleEntity.setTypeService(peisongType);
stockArticleEntity.setConsigneePerson(consigneeName);
stockArticleEntity.setConsigneeMobile(consigneeMobile);
stockArticleEntity.setConsigneeAddress(consigneeAddress);
stockArticleEntity.setMallId(consigneeId);
stockArticleEntity.setMallCode(consigneeCode);
stockArticleEntity.setMallName(consignee);
distributionStockArticleClient.saveOrUpdate(stockArticleEntity);
}
}
}
@ -1677,6 +1777,10 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
String agent = wayBillEntity.getAgent();
warehouseWaybill = new WarehouseWaybillEntity();
warehouseWaybill.setTenantId(TenantNum.HUITONGCODE);
warehouseWaybill.setCreateUser(1714696768639311873L);
warehouseWaybill.setUpdateUser(1714696768639311873L);
warehouseWaybill.setCreateDept(1649331096241836033L);
warehouseWaybill.setWaybillNo(waybillNo);
warehouseWaybill.setOrderNo(wayBillEntity.getOrderNo());
warehouseWaybill.setDestinationWarehouseName(warehouseName);
@ -1766,7 +1870,44 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
warehouseWaybill.setIsDeleted(0);
warehouseWaybill.setCreateTime(date);
warehouseWaybill.setUpdateTime(date);
warehouseWaybillClient.addEnntity(warehouseWaybill);
Long aLong = warehouseWaybillClient.addEnntity(warehouseWaybill);
if(aLong != 0){
List<WaybillDesEntity> desList = waybillDesClient.getDesList(waybillNo);
List<WarehouseWayBillDetail> warehouseWayBillDetails = new ArrayList<>();
for (WaybillDesEntity waybillDesEntity : desList) {
WarehouseWayBillDetail warehouseWayBillDetail = new WarehouseWayBillDetail();
warehouseWayBillDetail.setCreateUser(1714696768639311873L);
warehouseWayBillDetail.setUpdateUser(1714696768639311873L);
warehouseWayBillDetail.setCreateDept(1649331096241836033L);
warehouseWayBillDetail.setWaybillId(aLong);
warehouseWayBillDetail.setWaybillNo(waybillNo);
String goodsName = waybillDesEntity.getName();
BasicdataCategoryEntity categoryEntity = categoryClient.findByName(goodsName);
if(Objects.isNull(categoryEntity)){
categoryEntity = new BasicdataCategoryEntity();
categoryEntity.setName(goodsName);
categoryEntity.setType(1);
categoryEntity.setTenantId(TenantNum.HUITONGCODE);
categoryEntity.setCreateUser(1714696768639311873L);
categoryEntity.setUpdateUser(1714696768639311873L);
categoryEntity.setCreateDept(1649331096241836033L);
Long categoryId = categoryClient.addReturnId(categoryEntity);
warehouseWayBillDetail.setProductId(categoryId);
}else{
warehouseWayBillDetail.setProductId(categoryEntity.getId());
}
warehouseWayBillDetail.setProductName(goodsName);
warehouseWayBillDetail.setNum(waybillDesEntity.getNum());
warehouseWayBillDetail.setPrice(waybillDesEntity.getPrice());
warehouseWayBillDetail.setVolume(waybillDesEntity.getVolume());
warehouseWayBillDetail.setWeight(waybillDesEntity.getWeight());
warehouseWayBillDetail.setSubtotalFreight(waybillDesEntity.getTotalDesPrice());
warehouseWayBillDetail.setChargeType(waybillDesEntity.getPic());
warehouseWayBillDetails.add(warehouseWayBillDetail);
}
warehouseWaybillDetailClient.addList(warehouseWayBillDetails);
}
} else {
// warehouseWaybill.setStockCount(warehouseWaybill.getStockCount() + 1);
warehouseWaybill.setUpdateTime(new Date());

26
blade-service/logpm-warehouse/src/main/java/com/logpm/warehouse/service/impl/WarehouseTrayTypeServiceImpl.java

@ -3021,6 +3021,8 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
return R.data(trayTypeVO);
}
@Override
public R findSyncOldTrayData(String trayCode, Long warehouseId) {
@ -3050,9 +3052,22 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
for (TrayScanDesEntity trayScanDesEntity : trayScanDesEntityList) {
String orderPackageCode = trayScanDesEntity.getUnitNo();
trayScanId = trayScanDesEntity.getTrayScanId();
String orderSelfNum = trayScanDesEntity.getOrderSelfNum();
//通过订单号查询暂存单
AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderSelfNum);
if(Objects.isNull(advanceEntity)){
log.warn("#################findSyncOldTrayData: 未查询单订单信息 orderSelfNum={}",orderSelfNum);
throw new CustomerException(403,"未查询单订单信息");
}
Integer waybillStatus = advanceEntity.getWaybillStatus();
if(waybillStatus.equals(1)){
log.warn("#################findSyncOldTrayData: 老系统托盘有未开单数据 orderCode={}",orderSelfNum);
throw new CustomerException(403,"老系统托盘有未开单数据");
}
DistributionParcelListEntity parcelListEntity = distributionParcelListClient.findByPacketBarCodeAndWarehouseId(orderPackageCode, warehouseId);
if(Objects.isNull(parcelListEntity)){
set.add(trayScanDesEntity.getOrderSelfNum());
set.add(orderSelfNum);
}
orderPackageList.add(orderPackageCode);
}
@ -3060,7 +3075,6 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
saveOrderInfo(orderCode,oldWarehouseId,warehouseId);
}
String newTrayType = "100";
TrayScanEntity trayScanEntity = trayScanClient.getEntityByTrayScanId(trayScanId);
if(!Objects.isNull(trayScanEntity)){
@ -3182,6 +3196,14 @@ public class WarehouseTrayTypeServiceImpl extends BaseServiceImpl<WarehouseTrayT
throw new CustomerException(403,"未查询单订单信息");
}
Integer advanceId = advanceEntity.getId();
Integer waybillStatus = advanceEntity.getWaybillStatus();
String waybillNo = advanceEntity.getWaybillNo();
if(waybillStatus.equals(1)){
log.warn("#################saveOrderInfo: 订单还未开单 orderCode={}",orderCode);
throw new CustomerException(403,"订单还未开单");
}
//判断新系统是否有这条订单数据
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findStockArticleByOrderCodeAndWarehouseId(orderCode,newWarehouseId);

Loading…
Cancel
Save