Browse Source

Merge branch 'dev' into pre-production

chenglong
zhenghaoyu 1 year ago
parent
commit
c3ff9a9345
  1. 23
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCodeRecordEntity.java
  2. 9
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.java
  3. 7
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.xml
  4. 8
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeRecordService.java
  5. 15
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeRecordServiceImpl.java
  6. 45
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java
  7. 4
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

23
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCodeRecordEntity.java

@ -0,0 +1,23 @@
package com.logpm.basicdata.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
@Data
@TableName("logpm_basicdata_code_record")
@ApiModel(value = "生成码值表", description = "生成码值表")
@EqualsAndHashCode(callSuper = true)
public class BasicdataCodeRecordEntity extends TenantEntity {
private Integer codeType;
private Long warehouseId;
private String warehouseName;
private String warehouseCode;
private String year;
private String month;
private Integer num;
}

9
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.java

@ -0,0 +1,9 @@
package com.logpm.basicdata.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logpm.basicdata.entity.BasicdataCodeRecordEntity;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface BasicdataCodeRecordMapper extends BaseMapper<BasicdataCodeRecordEntity> {
}

7
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.xml

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.basicdata.mapper.BasicdataCodeRecordMapper">
</mapper>

8
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeRecordService.java

@ -0,0 +1,8 @@
package com.logpm.basicdata.service;
import com.logpm.basicdata.entity.BasicdataCodeRecordEntity;
import org.springblade.core.mp.base.BaseService;
public interface IBasicdataCodeRecordService extends BaseService<BasicdataCodeRecordEntity> {
BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(Integer type, String warehouseCode, String year, String month);
}

15
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeRecordServiceImpl.java

@ -0,0 +1,15 @@
package com.logpm.basicdata.service.impl;
import com.logpm.basicdata.entity.BasicdataCodeRecordEntity;
import com.logpm.basicdata.mapper.BasicdataCodeRecordMapper;
import com.logpm.basicdata.service.IBasicdataCodeRecordService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springframework.stereotype.Service;
@Slf4j
@Service
@AllArgsConstructor
public class BasicdataCodeRecordServiceImpl extends BaseServiceImpl<BasicdataCodeRecordMapper, BasicdataCodeRecordEntity> implements IBasicdataCodeRecordService {
}

45
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java

@ -2,10 +2,12 @@ package com.logpm.basicdata.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.basic.feign.IBasicTenantCodeClient; import com.logpm.basic.feign.IBasicTenantCodeClient;
import com.logpm.basicdata.entity.BasicdataCodeRecordEntity;
import com.logpm.basicdata.entity.BasicdataTrayEntity; import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity; import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient; import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.basicdata.mapper.BasicdataTrayMapper; import com.logpm.basicdata.mapper.BasicdataTrayMapper;
import com.logpm.basicdata.service.IBasicdataCodeRecordService;
import com.logpm.basicdata.service.IBasicdataCodeService; import com.logpm.basicdata.service.IBasicdataCodeService;
import com.logpm.basicdata.service.IBasicdataWarehouseService; import com.logpm.basicdata.service.IBasicdataWarehouseService;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@ -18,6 +20,7 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.utils.StringUtil; import org.springblade.core.tool.utils.StringUtil;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import java.util.Objects; import java.util.Objects;
@ -36,6 +39,8 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
private final BasicdataTrayMapper basicdataTrayMapper; private final BasicdataTrayMapper basicdataTrayMapper;
private final IBasicdataCodeRecordService basicdataCodeRecordService;
/** /**
* 根据类型生成编号 * 根据类型生成编号
* @param type * @param type
@ -285,17 +290,37 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
log.warn("############getWayBillNo: 仓库编码为空warehouseCode={}",warehouseCode); log.warn("############getWayBillNo: 仓库编码为空warehouseCode={}",warehouseCode);
return null; return null;
} }
//运单 仓库拼音+年月+(仓库当月数量+1)
//获得年月日短字符串 BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
String dateShort = CommonUtil.dateToStringShortYM(new Date()); if(Objects.isNull(basicdataWarehouseEntity)){
String key = warehouseCode + ":" +dateShort; log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
//获得序号 return null;
Long incr = bladeRedis.incr(key); }
if(1 == incr){
//如果为1就是刚刚才建立,给他一个过期时间 Calendar calendar = Calendar.getInstance();
bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd()); //获取年份
int year = calendar.get(Calendar.YEAR);
// 获取月份(注意月份从0开始计数)
int month = calendar.get(Calendar.MONTH) + 1;
BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+"");
if(Objects.isNull(basicdataCodeRecordEntity)){
basicdataCodeRecordEntity = new BasicdataCodeRecordEntity();
basicdataCodeRecordEntity.setCodeType(type);
basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId());
basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName());
basicdataCodeRecordEntity.setWarehouseCode(warehouseCode);
basicdataCodeRecordEntity.setYear(year+"");
basicdataCodeRecordEntity.setMonth(month+"");
basicdataCodeRecordEntity.setNum(0);
basicdataCodeRecordService.save(basicdataCodeRecordEntity);
} }
return warehouseCode+dateShort+CommonUtil.geFourNumber(incr,5); Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
return warehouseCode+year+month+CommonUtil.geFourNumber(inrc.longValue(),5);
} }

4
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/OpenOrderServiceImpl.java

@ -252,6 +252,10 @@ public class OpenOrderServiceImpl implements IOpenOrderService {
//如果运单号为空则自动生成运单号 //如果运单号为空则自动生成运单号
if(StringUtil.isBlank(waybillNo)){ if(StringUtil.isBlank(waybillNo)){
waybillNo = basicdataCodeClient.getCodeByType(CodeNumConstant.WAYBILL, warehouseCode, ""); waybillNo = basicdataCodeClient.getCodeByType(CodeNumConstant.WAYBILL, warehouseCode, "");
WarehouseWaybillEntity warehouseWaybillEntity = warehouseWaybillClient.findByWaybillNo(waybillNo);
while(!Objects.isNull(warehouseWaybillEntity)){
waybillNo = basicdataCodeClient.getCodeByType(CodeNumConstant.WAYBILL, warehouseCode, "");
}
} }
Long departureWarehouseId = openOrderDTO.getDepartureWarehouseId(); Long departureWarehouseId = openOrderDTO.getDepartureWarehouseId();
Long destinationWarehouseId = openOrderDTO.getDestinationWarehouseId(); Long destinationWarehouseId = openOrderDTO.getDestinationWarehouseId();

Loading…
Cancel
Save