Browse Source

自提编码规则修改

visual
汤建军 5 months ago
parent
commit
b5a893f07c
  1. 2
      blade-biz-common/src/main/java/org/springblade/common/constant/basiccode/BasicCodeTypeConstant.java
  2. 13
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java
  3. 84
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

2
blade-biz-common/src/main/java/org/springblade/common/constant/basiccode/BasicCodeTypeConstant.java

@ -41,7 +41,7 @@ public enum BasicCodeTypeConstant {
APPOINTMENT_CODE("预约单码","22"),
// 备货码
STOCK_CODE("备货码","23"),
RENTION_CODE("回库码","23");
RENTION_CODE("回库码","24");
/**

13
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistributionReservationServiceImpl.java

@ -1021,7 +1021,14 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
@Override
public String trainNumberMa() {
StringBuilder sb = new StringBuilder();
sb.append("PSCC");
String tenantCode = "HK";
BasicTenantCodeEntity basicTenantCodeByCodeAndShowType = basicTenantCodeClient.findBasicTenantCodeByCodeAndShowType(BasicCodeTypeConstant.DELIVERY_PLAN_CODE.getValue(), BasicCodeShowConstant.QR_CODE.getValue());
if (ObjectUtils.isNull(basicTenantCodeByCodeAndShowType)) {
log.error("获取货区码失败");
} else {
tenantCode = basicTenantCodeByCodeAndShowType.getCode();
}
sb.append(tenantCode);
BladeUser user = AuthUtil.getUser();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String format1 = format.format(new Date());
@ -1029,13 +1036,13 @@ public class DistributionReservationServiceImpl extends BaseServiceImpl<Distribu
if (ObjectUtil.isNotEmpty(warehouseByDepartment)) {
sb.append(warehouseByDepartment.getWarehouseCode());
sb.append(format1);
String s = "PSCC" + warehouseByDepartment.getWarehouseCode();
String s = tenantCode + warehouseByDepartment.getWarehouseCode();
String s1 = jiShuan(s);
sb.append(s1);
} else {
sb.append("00000");
sb.append(format1);
String s = "PSCC" + "00000";
String s = tenantCode + "00000";
String s1 = jiShuan(s);
sb.append(s1);
}

84
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/DistrilbutionBillLadingServiceImpl.java

@ -29,6 +29,8 @@ import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.logpm.basic.entity.BasicTenantCodeEntity;
import com.logpm.basic.feign.IBasicTenantCodeClient;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.distribution.bean.Resp;
@ -84,6 +86,8 @@ import org.apache.logging.log4j.util.Strings;
import org.jetbrains.annotations.NotNull;
import org.springblade.common.constant.*;
import org.springblade.common.constant.Inventory.*;
import org.springblade.common.constant.basiccode.BasicCodeShowConstant;
import org.springblade.common.constant.basiccode.BasicCodeTypeConstant;
import org.springblade.common.constant.billLading.BillLadingStatusConstant;
import org.springblade.common.constant.common.IsOrNoConstant;
import org.springblade.common.constant.order.OrderReservationStatusConstant;
@ -116,6 +120,7 @@ import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.system.cache.DictBizCache;
import org.springblade.system.entity.User;
@ -225,6 +230,9 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
@Autowired
private IWarehouseConfigClient warehouseConfigClient;
@Autowired
private IBasicTenantCodeClient basicTenantCodeClient;
@Override
public IPage<DistrilbutionBillLadingVO> selectDistrilbutionBillLadingPage(IPage<DistrilbutionBillLadingVO> page, DistrilbutionBillLadingVO distrilbutionBillLading) {
@ -632,9 +640,7 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
distrilbutionBillLading.setStockupCode(distributionReservationService.bianMa());
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String format = dateFormat.format(new Date());
distrilbutionBillLading.setPickupBatch("ZT" + format);//批次号
distrilbutionBillLading.setPickupBatch(billMa());//批次号
if (ObjectUtils.isNull(myCurrentWarehouse)) {
throw new ServiceException("请选择仓库在操作!!!");
}
@ -4999,4 +5005,76 @@ public class DistrilbutionBillLadingServiceImpl extends BaseServiceImpl<Distrilb
}
public String billMa() {
StringBuilder sb = new StringBuilder();
String tenantCode = "ZT";
BasicTenantCodeEntity basicTenantCodeByCodeAndShowType = basicTenantCodeClient.findBasicTenantCodeByCodeAndShowType(BasicCodeTypeConstant.DELIVERY_PLAN_CODE.getValue(), BasicCodeShowConstant.QR_CODE.getValue());
if (ObjectUtils.isNull(basicTenantCodeByCodeAndShowType)) {
log.error("获取货区码失败");
} else {
tenantCode = basicTenantCodeByCodeAndShowType.getCode();
}
sb.append(tenantCode);
BladeUser user = AuthUtil.getUser();
SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
String format1 = format.format(new Date());
BasicdataWarehouseEntity warehouseByDepartment = basicdataWarehouseClient.getMyCurrentWarehouse();
if (ObjectUtil.isNotEmpty(warehouseByDepartment)) {
sb.append(warehouseByDepartment.getWarehouseCode());
sb.append(format1);
String s = tenantCode + warehouseByDepartment.getWarehouseCode();
String s1 = jiShuan(s);
sb.append(s1);
} else {
sb.append("00000");
sb.append(format1);
String s = tenantCode + "00000";
String s1 = jiShuan(s);
sb.append(s1);
}
return sb.toString();
}
private String jiShuan(String s) {
String n = "00001";
if (Func.notNull(redis.get(s))) {
Object o1 = redis.get(s);
int anInt = Integer.parseInt(String.valueOf(o1));
if (anInt < 10) {
if (anInt + 1 == 10) {
n = String.format("000%d", anInt + 1);
} else {
n = String.format("0000%d", anInt + 1);
}
} else if (anInt < 100) {
if (anInt + 1 == 100) {
n = String.format("00%d", anInt + 1);
} else {
n = String.format("000%d", anInt + 1);
}
} else if (anInt < 1000) {
if (anInt + 1 == 1000) {
n = String.format("0%d", anInt + 1);
} else {
n = String.format("00%d", anInt + 1);
}
} else if (anInt < 10000) {
if (anInt + 1 == 10000) {
n = String.format("%d", anInt + 1);
} else {
n = String.format("0%d", anInt + 1);
}
} else {
n = String.valueOf(anInt + 1);
}
redis.set(s, n);
return n;
} else {
redis.set(s, n);
return n;
}
}
}

Loading…
Cancel
Save