Browse Source

Merge branch 'dev' into pre-production

newStockUp
zhenghaoyu 1 year ago
parent
commit
c5f7418da6
  1. 3
      blade-service-api/logpm-distribution-api/src/main/java/com/logpm/distribution/feign/IDistributionParcelListClient.java
  2. 9
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/feign/DistributionParcelListClient.java
  3. 5
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java
  4. 28
      blade-service/logpm-patch/src/main/java/com/logpm/patch/jobhandle/SyncOrderInfoToPlatform.java
  5. 2
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/ISyncOrderInfoService.java
  6. 204
      blade-service/logpm-patch/src/main/java/com/logpm/patch/service/impl/SyncOrderInfoServiceImpl.java

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

@ -99,4 +99,7 @@ public interface IDistributionParcelListClient {
@PostMapping(API_PREFIX+"/addReturnId") @PostMapping(API_PREFIX+"/addReturnId")
Long addReturnId(@RequestBody DistributionParcelListEntity entity); Long addReturnId(@RequestBody DistributionParcelListEntity entity);
@GetMapping(API_PREFIX+"/updateStockArticleIdByOrderCode")
void updateStockArticleIdByOrderCode(@RequestParam Long orderId, @RequestParam String orderCode);
} }

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

@ -17,6 +17,7 @@
package com.logpm.distribution.feign; package com.logpm.distribution.feign;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils; import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
@ -163,4 +164,12 @@ public class DistributionParcelListClient implements IDistributionParcelListClie
distributionParcelListService.save(entity); distributionParcelListService.save(entity);
return entity.getId(); return entity.getId();
} }
@Override
public void updateStockArticleIdByOrderCode(Long orderId, String orderCode) {
UpdateWrapper<DistributionParcelListEntity> updateWrapper = new UpdateWrapper<>();
updateWrapper.set("stock_article_id",orderId)
.eq("order_code",orderCode);
distributionParcelListService.update(updateWrapper);
}
} }

5
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionDeliveryListServiceImpl.java

@ -3416,7 +3416,10 @@ public class DistributionDeliveryListServiceImpl extends BaseServiceImpl<Distrib
// DistributionStockupVO stockupEntity = distributionStockupMapper.getDeliveryStockupInfo(id); // DistributionStockupVO stockupEntity = distributionStockupMapper.getDeliveryStockupInfo(id);
// deliveryListVO.setStockupInfo(stockupEntity); // deliveryListVO.setStockupInfo(stockupEntity);
List<DistributionReservationEntity> reservationVOS = distributionReservationMapper.getMarketReservationInfo(id); List<DistributionReservationEntity> reservationVOS = distributionReservationMapper.getMarketReservationInfo(id);
deliveryListVO.setReservationInfos(DistributionReservationWrapper.build().listVO(reservationVOS)); if(ObjectUtil.isNotEmpty(reservationVOS)){
deliveryListVO.setReservationInfos(DistributionReservationWrapper.build().listVO(reservationVOS));
}
return deliveryListVO; return deliveryListVO;
} }

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

@ -14,6 +14,7 @@ import com.xxl.job.core.handler.annotation.XxlJob;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springblade.common.exception.CustomerException; import org.springblade.common.exception.CustomerException;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.List; import java.util.List;
@ -288,4 +289,31 @@ public class SyncOrderInfoToPlatform {
} }
@XxlJob("supplementOrderInfo")
public ReturnT<String> supplementOrderInfo(String param) {
log.info("############supplementOrderInfo: 订单数据补充");
if(StringUtil.isBlank(param)){
log.info("##############supplementOrderInfo: 参数不能为空 ");
return ReturnT.FAIL;
}
String[] split = param.split(",");
List<WarehouseMappingDataEntity> warehouseMappingDataEntityList = warehouseMappingDataService.getWarehouseMapping();
if(warehouseMappingDataEntityList.isEmpty()){
log.warn("###############syncZeroOrderInfo: 当前没有配置需要同步的仓库信息");
return ReturnT.FAIL;
}
WarehouseMappingDataEntity warehouseMappingDataEntity = warehouseMappingDataEntityList.get(0);
Long newWarehouseId = warehouseMappingDataEntity.getNewWarehouseId();
Integer oldWarehouseId = warehouseMappingDataEntity.getOldWarehouseId();
for (String orderCode:split){
syncOrderInfoService.supplementOrderInfo(orderCode,newWarehouseId,oldWarehouseId);
}
return ReturnT.SUCCESS;
}
} }

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

@ -11,4 +11,6 @@ public interface ISyncOrderInfoService {
void addTrayType(Integer oldWarehouseId, Long newWarehouseId); void addTrayType(Integer oldWarehouseId, Long newWarehouseId);
void supplementOrderInfo(String orderCode, Long newWarehouseId, Integer oldWarehouseId);
} }

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

@ -243,6 +243,210 @@ public class SyncOrderInfoServiceImpl implements ISyncOrderInfoService {
} }
@Override
public void supplementOrderInfo(String orderCode, Long newWarehouseId, Integer oldWarehouseId) {
//通过订单号查询暂存单
AdvanceEntity advanceEntity = advanceClient.getQueryDataOne(orderCode);
if(Objects.isNull(advanceEntity)){
log.warn("#################saveOrderInfo: 未查询单订单信息 orderCode={}",orderCode);
throw new CustomerException(403,"未查询单订单信息");
}
Integer advanceId = advanceEntity.getId();
//判断新系统是否有这条订单数据
DistributionStockArticleEntity distributionStockArticleEntity = distributionStockArticleClient.findByAdvanceId(advanceId);
OrderCountEntity orderCountEntity = orderCountClient.getEntityByOrderCode(orderCode,oldWarehouseId);
if(Objects.isNull(orderCountEntity)){
log.warn("#################saveOrderInfo: 未查询单订单信息 orderCode={}",orderCode);
throw new CustomerException(403,"未查询单订单信息");
}
Integer total = orderCountEntity.getTotal();
WayBillEntity wayBillEntity = wayBillClient.getByWayBillByAdvanceId(advanceId);
// if(Objects.isNull(wayBillEntity)){
// log.warn("#################saveOrderInfo: 未查询到运单信息 advanceId={}",advanceId);
// throw new CustomerException(403,"未查询到运单信息");
// }
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseClient.getEntityWarehouseId(newWarehouseId);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("#################saveOrderInfo: 未查询到仓库信息 newWarehouseId={}",newWarehouseId);
throw new CustomerException(403,"未查询到仓库信息");
}
Long orderId;
String wayBillNo = null;
if (Objects.isNull(distributionStockArticleEntity)) {
Date date = new Date();
distributionStockArticleEntity = new DistributionStockArticleEntity();
distributionStockArticleEntity.setOrderCode(orderCode);
// 其实是客户
distributionStockArticleEntity.setMallName(advanceEntity.getDealerName());
distributionStockArticleEntity.setWarehouseEntryTime(orderCountEntity.getCreateTime());
distributionStockArticleEntity.setWarehouseEntryTimeEnd(orderCountEntity.getLatestInTime());
distributionStockArticleEntity.setTotalNumber(total);
distributionStockArticleEntity.setHandQuantity(orderCountEntity.getInNum());
distributionStockArticleEntity.setTenantId(TenantNum.HUITONGCODE);// 对应租户ID
// distributionStockArticleEntity.setWaybillNumber();// 运单号
//判断是否齐套 查询该订单自编号下面的包件是都全部都交由汇通了
Integer allNum = advanceDetailClient.getAllNumByOrderNo(orderCode);
if (total.equals(allNum)) {
//如果数据库中的数据和订单上的数量相等就是齐套
distributionStockArticleEntity.setCompleteSet(1);
} else {
distributionStockArticleEntity.setCompleteSet(0);
}
log.info("############saveOrderInfo {}", basicdataWarehouseEntity);
distributionStockArticleEntity.setCreateDept(basicdataWarehouseEntity.getDepartment());
distributionStockArticleEntity.setConsigneeUnit(advanceEntity.getDealerName());//收货单位(经销商)
distributionStockArticleEntity.setConsigneePerson(advanceEntity.getCustomerName());//收货人
distributionStockArticleEntity.setConsigneeAddress(advanceEntity.getCustomerRoad());//收货人地址
distributionStockArticleEntity.setConsigneeMobile(advanceEntity.getCustomerPhone());//收货人电话
distributionStockArticleEntity.setWarehouse(basicdataWarehouseEntity.getName());
distributionStockArticleEntity.setWarehouseId(basicdataWarehouseEntity.getId());
distributionStockArticleEntity.setDealerCode(advanceEntity.getDealerCode());
distributionStockArticleEntity.setDealerName(advanceEntity.getDealerName());
if (ObjectUtils.isNotNull(wayBillEntity)) {
distributionStockArticleEntity.setConsigneeUnit(wayBillEntity.getTakeCompany());//收货单位(经销商)
distributionStockArticleEntity.setConsigneePerson(wayBillEntity.getTakePerson());//收货人
distributionStockArticleEntity.setConsigneeAddress(wayBillEntity.getTakeAddress());//收货人地址
distributionStockArticleEntity.setConsigneeMobile(wayBillEntity.getTakePhone());//收货人电话
wayBillNo = wayBillEntity.getWaybillNo();
distributionStockArticleEntity.setWaybillNumber(wayBillNo);
// 根据老运单上的仓库名称找寻新的仓库名称
// 发站
String warehouseName = wayBillEntity.getStartSite();
BasicdataWarehouseEntity t = basicdataWarehouseClient.findByName(warehouseName);
if(ObjectUtils.isNotNull(t)){
distributionStockArticleEntity.setSendWarehouseName(t.getName());
distributionStockArticleEntity.setSendWarehouseId(t.getId());
}
//收货仓库
warehouseName = wayBillEntity.getWarehouseName();
t = basicdataWarehouseClient.findByName(warehouseName);
if(ObjectUtils.isNotNull(t)){
distributionStockArticleEntity.setAcceptWarehouseName(t.getName());
distributionStockArticleEntity.setAcceptWarehouseId(t.getId());
// TODO 这里存在问题 后需要知道当前作业仓库
// distributionStockArticleEntity.setWarehouse(t.getName());
// distributionStockArticleEntity.setWarehouseId(t.getId());
}
String customerName = wayBillEntity.getTakeCompany();//客户名称
BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findByName(customerName);
log.info("订单同步出现的客户编号{} 匹配的客户", basicdataClientEntity);
if (!Objects.isNull(basicdataClientEntity)) {
//商城
distributionStockArticleEntity.setMallId(basicdataClientEntity.getId());
distributionStockArticleEntity.setMallName(basicdataClientEntity.getClientName());
distributionStockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
distributionStockArticleEntity.setDealerCode(basicdataClientEntity.getClientCode());
distributionStockArticleEntity.setDealerName(basicdataClientEntity.getClientName());
// todo 这里需要去查询门店 和新系统的门店ID 进行绑定
String peisongType = getPeisongTypeByClientId(basicdataClientEntity.getId());
log.info("订单同步peisongType {} ", peisongType);
if (StringUtil.isNoneBlank(peisongType)) {
distributionStockArticleEntity.setTypeService(peisongType);
}
}
}
//通过客户名称去查询客户的服务类型、
distributionStockArticleEntity.setTypeService("1");//默认商配
// BasicdataClientEntity basicdataClientEntity = basicdataClientClient.findByName(customerName);
// log.info("订单同步出现的客户编号{} 匹配的客户", basicdataClientEntity);
// if (!Objects.isNull(basicdataClientEntity)) {
// //商城
// distributionStockArticleEntity.setMallId(basicdataClientEntity.getId());
// distributionStockArticleEntity.setMallName(basicdataClientEntity.getClientName());
// distributionStockArticleEntity.setMallCode(basicdataClientEntity.getClientCode());
//
// distributionStockArticleEntity.setDealerCode(basicdataClientEntity.getClientCode());
// distributionStockArticleEntity.setDealerName(basicdataClientEntity.getClientName());
//
//
// // todo 这里需要去查询门店 和新系统的门店ID 进行绑定
// String peisongType = getPeisongTypeByClientId(basicdataClientEntity.getId());
// log.info("订单同步peisongType {} ", peisongType);
//
// if (StringUtil.isNoneBlank(peisongType)) {
// distributionStockArticleEntity.setTypeService(peisongType);
// }
// }
distributionStockArticleEntity.setGenre(1);
distributionStockArticleEntity.setAdvanceId(advanceId);
//--------------2023-07-06 新增字段处理
// 增加订单 经销商信息 和门店信息
buildDealerAndStore(distributionStockArticleEntity, advanceEntity);
distributionStockArticleEntity.setCreateUser(1123598821738675201L);
distributionStockArticleEntity.setSortingQuantity(orderCountEntity.getSorting()); //分拣件数
distributionStockArticleEntity.setDeliveryQuantity(orderCountEntity.getDeliveNum()); //配送件数
distributionStockArticleEntity.setTransferQuantity(orderCountEntity.getTransNum()); //中转件数
distributionStockArticleEntity.setSigninQuantity(orderCountEntity.getSignNum()); //签收件数
//1=部分入库,2=已入库,3=已出库,4=部分签收,5=待出库,6=已上架,7=已分拣,8=部分出库,9=部分装车,10=已装车,11=已签收,12=部分配送,13=已配送
distributionStockArticleEntity.setFreezeStatus(OrderFreezeStatusConstant.weidongjie.getValue()); //冻结状态
distributionStockArticleEntity.setReservationStatus(OrderReservationStatusConstant.daiyuyue.getValue()); //预约状态
distributionStockArticleEntity.setStockupStatus(OrderStockupStatusConstant.daibeihuo.getValue()); //备货状态
distributionStockArticleEntity.setGroundingStatus(OrderGroundingStatusConstant.daishangjia.getValue()); //上架状态
Integer status = orderCountEntity.getStatus();
if(1 == status){
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenruku.getValue());
}else if(2 == status){
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.ruku.getValue());
}else if(3 == status || 10 == status){
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.chuku.getValue());
}else if(4 == status){
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenqianshou.getValue());
}else if(8 == status || 9 == status){
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.bufenchuku.getValue());
}else if(11 == status){
distributionStockArticleEntity.setOrderStatus(OrderStatusConstant.qianshou.getValue());
}else{
distributionStockArticleEntity.setOrderStatus("100");
}
distributionStockArticleEntity.setOrderReceiveStatus(OrderReceiveStatusConstant.yishouhuo.getValue());
distributionStockArticleEntity.setWarehouseEntryTime(date);
orderId = distributionStockArticleClient.addData(distributionStockArticleEntity);
distributionStockArticleEntity.setId(orderId);
if (orderId == 0) {
log.warn("#################handleDataToPlatform: 保存订单信息失败 orderCode={}", orderCode);
throw new CustomerException(405, "保存订单信息失败");
}
}else{
orderId = distributionStockArticleEntity.getId();
}
//通过订单号更新所有包件下面的关联订单id
distributionParcelListClient.updateStockArticleIdByOrderCode(orderId,orderCode);
}
private void saveTrayTypeInfoPackage(String orderCode,Integer oldWarehouseId,Long newWarehouseId) { private void saveTrayTypeInfoPackage(String orderCode,Integer oldWarehouseId,Long newWarehouseId) {
//如果是订制品就先查询该订单有哪些包件打了托 //如果是订制品就先查询该订单有哪些包件打了托

Loading…
Cancel
Save