Browse Source

Merge branch 'dev' into pre-production

newStockUp
zhenghaoyu 1 year ago
parent
commit
28dbd9f1ad
  1. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java
  2. 67
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/excel/DistributionStockArticleExcel.java
  3. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java
  4. 2
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml
  5. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java
  6. 56
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java
  7. 14
      blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java
  8. 7
      blade-service/logpm-factory/src/main/java/com/logpm/factory/pan/service/impl/PanFactoryDataServiceImpl.java
  9. 10
      blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/controller/DistributionStockArticleController.java

@ -16,10 +16,8 @@
*/
package com.logpm.distribution.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
@ -38,7 +36,6 @@ import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
@ -48,7 +45,6 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.feign.IDictBizClient;
import org.springblade.system.feign.IUserClient;
import org.springframework.web.bind.annotation.*;
@ -60,7 +56,6 @@ import javax.validation.Valid;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
/**
* 配送在库订单 控制器
@ -353,12 +348,8 @@ public class DistributionStockArticleController extends BladeController {
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导出数据", notes = "传入distributionStockArticle")
public void exportDistributionStockArticle(@ApiIgnore @RequestParam Map<String, Object> distributionStockArticle, BladeUser bladeUser, HttpServletResponse response) {
QueryWrapper<DistributionStockArticleEntity> queryWrapper = Condition.getQueryWrapper(distributionStockArticle, DistributionStockArticleEntity.class);
//if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(DistributionStockArticle::getTenantId, bladeUser.getTenantId());
//}
queryWrapper.lambda().eq(DistributionStockArticleEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<DistributionStockArticleExcel> list = distributionStockArticleService.exportDistributionStockArticle(queryWrapper);
List<DistributionStockArticleExcel> list = distributionStockArticleService.exportDistributionStockArticle(distributionStockArticle);
ExcelUtil.export(response, "配送在库订单数据" + DateUtil.time(), "配送在库订单数据表", list, DistributionStockArticleExcel.class);
}

67
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/excel/DistributionStockArticleExcel.java

@ -40,49 +40,6 @@ import java.util.Date;
public class DistributionStockArticleExcel implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 租户号
*/
@ColumnWidth(20)
@ExcelProperty("租户号")
private String tenantId;
/**
* 是否已删除
*/
@ColumnWidth(20)
@ExcelProperty("是否已删除")
private Integer isDeleted;
/**
* 预留1
*/
@ColumnWidth(20)
@ExcelProperty("预留1")
private String reserve1;
/**
* 预留2
*/
@ColumnWidth(20)
@ExcelProperty("预留2")
private String reserve2;
/**
* 预留3
*/
@ColumnWidth(20)
@ExcelProperty("预留3")
private String reserve3;
/**
* 预留4
*/
@ColumnWidth(20)
@ExcelProperty("预留4")
private String reserve4;
/**
* 预留5
*/
@ColumnWidth(20)
@ExcelProperty("预留5")
private String reserve5;
/**
* 服务号
*/
@ -94,7 +51,7 @@ public class DistributionStockArticleExcel implements Serializable {
*/
@ColumnWidth(20)
@ExcelProperty("订单自编号")
private String orderSelfNumbering;
private String orderCode;
/**
* 商场名称
*/
@ -130,7 +87,7 @@ public class DistributionStockArticleExcel implements Serializable {
*/
@ColumnWidth(20)
@ExcelProperty("在库时间")
private Date storeTime;
private String storeTime;
/**
* 订单总件数
*/
@ -148,7 +105,7 @@ public class DistributionStockArticleExcel implements Serializable {
*/
@ColumnWidth(20)
@ExcelProperty("是否齐套")
private Integer completeSet;
private String completeSet;
/**
* 品牌
*/
@ -198,16 +155,22 @@ public class DistributionStockArticleExcel implements Serializable {
@ExcelProperty("收货单位")
private String consigneeUnit;
/**
* 类型;1 预约单 2库存单
* 订单来源
*/
@ColumnWidth(20)
@ExcelProperty("类型;1 预约单 2库存单")
private Integer genre;
@ExcelProperty("订单来源")
private String resource;
/**
* 类型;1 预约单 2库存单
*/
// @ColumnWidth(20)
// @ExcelProperty("类型;1 预约单 2库存单")
// private Integer genre;
/**
* 状态;1 配送 2 待配送
*/
@ColumnWidth(20)
@ExcelProperty("状态;1 配送 2 待配送")
private Integer state;
// @ColumnWidth(20)
// @ExcelProperty("状态;1 配送 2 待配送")
// private Integer state;
}

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.java

@ -58,7 +58,7 @@ public interface DistributionStockArticleMapper extends BaseMapper<DistributionS
* @param queryWrapper
* @return
*/
List<DistributionStockArticleExcel> exportDistributionStockArticle(@Param("ew") Wrapper<DistributionStockArticleEntity> queryWrapper);
List<DistributionStockArticleEntity> exportDistributionStockArticle(@Param("ew") Wrapper<DistributionStockArticleEntity> queryWrapper);
void addHandQuantity(@Param("id") Long id,@Param("num") int num);

2
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionStockArticleMapper.xml

@ -56,7 +56,7 @@
</select>
<select id="exportDistributionStockArticle" resultType="com.logpm.distribution.excel.DistributionStockArticleExcel">
<select id="exportDistributionStockArticle" resultType="com.logpm.distribution.entity.DistributionStockArticleEntity">
SELECT * FROM logpm_distribution_stock_article ${ew.customSqlSegment}
</select>

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionStockArticleService.java

@ -16,8 +16,6 @@
*/
package com.logpm.distribution.service;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.logpm.distribution.dto.DistributionStockArticleDTO;
import com.logpm.distribution.dto.app.queryOrderDTO;
@ -56,10 +54,9 @@ public interface IDistributionStockArticleService extends BaseService<Distributi
/**
* 导出数据
*
* @param queryWrapper
* @return
* @param distributionStockArticle@return
*/
List<DistributionStockArticleExcel> exportDistributionStockArticle(Wrapper<DistributionStockArticleEntity> queryWrapper);
List<DistributionStockArticleExcel> exportDistributionStockArticle(Map<String, Object> distributionStockArticle);
Boolean saveStock(String ids);

56
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionStockArticleServiceImpl.java

@ -16,9 +16,7 @@
*/
package com.logpm.distribution.service.impl;
import cn.hutool.core.util.ArrayUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
@ -62,6 +60,7 @@ import org.springblade.core.mp.support.Query;
import org.springblade.core.secure.BladeUser;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
@ -132,14 +131,49 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
return page.setRecords(distributionStockArticleVOS);
}
/**
* 导出数据
* @param distributionStockArticle@return
* @return
*/
@Override
public List<DistributionStockArticleExcel> exportDistributionStockArticle(Wrapper<DistributionStockArticleEntity> queryWrapper) {
List<DistributionStockArticleExcel> distributionStockArticleList = baseMapper.exportDistributionStockArticle(queryWrapper);
//distributionStockArticleList.forEach(distributionStockArticle -> {
// distributionStockArticle.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionStockArticle.getType()));
//});
return distributionStockArticleList;
public List<DistributionStockArticleExcel> exportDistributionStockArticle(Map<String, Object> distributionStockArticle) {
Object o = distributionStockArticle.get("ids");
if(ObjectUtils.isNotNull(o)){
distributionStockArticle.remove("ids");
}
QueryWrapper<DistributionStockArticleEntity> queryWrapper = Condition.getQueryWrapper(distributionStockArticle, DistributionStockArticleEntity.class);
//if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(DistributionStockArticle::getTenantId, bladeUser.getTenantId());
//}
queryWrapper.lambda().eq(DistributionStockArticleEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
if(ObjectUtils.isNotNull(o)){
queryWrapper.in("id",String.valueOf(o).split(","));
}
BasicdataWarehouseEntity myCurrentWarehouse = warehouseClient.getMyCurrentWarehouse();
if(ObjectUtils.isNull(myCurrentWarehouse)){
throw new ServiceException("没有仓库信息!");
}
queryWrapper.eq("warehouse_id",myCurrentWarehouse.getId());
queryWrapper.apply("order_status != 70");
List<DistributionStockArticleEntity> list = baseMapper.exportDistributionStockArticle(queryWrapper);
List<DistributionStockArticleExcel> listExcel = new ArrayList<>();
list.forEach(s -> {
// distributionStockArticle.setTypeName(DictCache.getValue(DictEnum.YES_NO, DistributionStockArticle.getType()));
DistributionStockArticleExcel stockArticleExcel = new DistributionStockArticleExcel();
BasicdataWarehouseEntity entityWarehouse = warehouseClient.getEntityWarehouseId(s.getWarehouseId());
BeanUtil.copyProperties(s,stockArticleExcel);
stockArticleExcel.setWarehouseCode(entityWarehouse.getWarehouseCode());
String s1 = s.getCompleteSet().equals("1") ? "否" : "是";
stockArticleExcel.setCompleteSet(s1);
String value = DictBizCache.getValue(DictBizConstant.DISTRIBUTION_TYPE, s.getTypeService());
stockArticleExcel.setTypeService(value);
listExcel.add(stockArticleExcel);
});
return listExcel;
}
/**
@ -1013,7 +1047,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
stockArticleEntity.setFreezeStatus("10");
stockArticleEntity.setBrand(i.getBrand());
stockArticleEntity.setDescriptionGoods(i.getDescriptionGoods());
stockArticleEntity.setOrderCode(i.getOrderSelfNumbering());
stockArticleEntity.setOrderCode(i.getOrderCode());
stockArticleEntity.setMallName(i.getMallName());
stockArticleEntity.setTotalNumber(i.getTotalNumber());
stockArticleEntity.setHandQuantity(i.getHandQuantity());
@ -1038,7 +1072,7 @@ public class DistributionStockArticleServiceImpl extends BaseServiceImpl<Distrib
parcelListEntity.setWarehouse(i.getWarehouse());
parcelListEntity.setWarehouseId(warehouse.getId());
parcelListEntity.setConditions(1);
parcelListEntity.setOrderCode(i.getOrderSelfNumbering());
parcelListEntity.setOrderCode(i.getOrderCode());
parcelListEntity.setServiceNumber(i.getServiceNumber());
parcelListEntity.setBrandName(Optional.ofNullable(i.getBrand()).orElse(null));
if(i.getDescriptionGoods().contains(",")){

14
blade-service/logpm-factory/src/main/java/com/logpm/factory/comfac/service/impl/FactoryCommonServiceImpl.java

@ -14,6 +14,8 @@ import com.logpm.warehouse.feign.IWarehouseTrayTypeClient;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@ -31,9 +33,21 @@ public class FactoryCommonServiceImpl implements IFactoryCommonService {
private final ITrayClient trayClient;
private final ITrayScanClient trayScanClient;
private final BladeRedis bladeRedis;
@Override
public void syncTrayTypeData(String unitNo, Integer trayId, String oldWarehouseId) {
//先判断是否两个数据已经执行完成
String ruku = bladeRedis.get("arrive-"+unitNo);
String tray = bladeRedis.get("tray-"+unitNo);
if(StringUtil.isBlank(ruku) || StringUtil.isBlank(tray)){
log.error("###############syncTrayTypeData: 数据不完整,暂不打托 ruku={} tray={}",ruku,tray);
throw new CustomerException(403,"数据不完整,暂不打托");
}
log.info("###############syncTrayTypeData: 包件打托开始 unitNo={} trayId={} oldWarehouseId={}",unitNo,trayId,oldWarehouseId);
//先判断新系统仓库信息是否存在
BasicdataWarehouseEntity warehouseEntity = basicdataWarehouseClient.getWarehouseByOldId(Integer.parseInt(oldWarehouseId));

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

@ -49,6 +49,7 @@ import org.springblade.common.constant.order.*;
import org.springblade.common.constant.orderpackage.*;
import org.springblade.common.exception.CustomerException;
import org.springblade.common.utils.CommonUtil;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
@ -93,6 +94,8 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
private final ITrayScanClient trayScanClient;
private final IWarehouseTrayTypeClient warehouseTrayTypeClient;
private final BladeRedis bladeRedis;
// @Override
// public FactoryTokenVO getToken(String corpId, String appKey, String appSecret) throws NoSuchAlgorithmException {
//
@ -552,6 +555,10 @@ public class PanFactoryDataServiceImpl implements IPanFactoryDataService {
//已存在包件信息那就不处理
logger.info("#################handleDataToPlatform: 包件信息已存在,不用处理 unitNo={}", unitNo);
}
//存入包条缓存
bladeRedis.setEx("arrive-"+unitNo,unitNo,30L);
}
private void saveTrayTypeInfoPackage(String unitNo,Integer oldWarehouseId,Long newWarehouseId) {

10
blade-service/logpm-factory/src/main/java/com/logpm/factory/receiver/DealWithDataHandler.java

@ -8,6 +8,7 @@ import com.rabbitmq.client.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant;
import org.springblade.common.exception.CustomerException;
import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.tool.utils.StringUtil;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
@ -35,6 +36,8 @@ public class DealWithDataHandler {
private IPanFactoryDataService panFactoryDataService;
@Autowired
private IFactoryCommonService factoryCommonService;
@Autowired
private BladeRedis bladeRedis;
private Integer retryCount = 1;
@ -70,12 +73,11 @@ public class DealWithDataHandler {
if ("4".equals(status)) {
panFactoryDataService.handleDataToPlatform(unitNo, operationTime);
}else if("2".equals(status)){
// //同步打托数据
// if(!Objects.isNull(trayId)){
// factoryCommonService.syncTrayTypeData(unitNo,trayId,currentWarehouseId);
// }
bladeRedis.setEx("tray-"+unitNo,unitNo,30L);
}
//同步打托数据
factoryCommonService.syncTrayTypeData(unitNo,trayId,currentWarehouseId);
} catch (Exception e) {
e.printStackTrace();

Loading…
Cancel
Save