Browse Source

1.干线-bug修复

chenglong
zhenghaoyu 1 year ago
parent
commit
f07185f1f2
  1. 320
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java
  2. 6
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml
  3. 24
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

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

@ -1,9 +1,7 @@
package com.logpm.basicdata.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.logpm.basic.feign.IBasicTenantCodeClient;
import com.logpm.basicdata.entity.BasicdataCodeRecordEntity;
import com.logpm.basicdata.entity.BasicdataTrayEntity;
import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.feign.IBasicdataWarehouseClient;
import com.logpm.basicdata.mapper.BasicdataTrayMapper;
@ -103,23 +101,39 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
}
String dateShort = CommonUtil.dateToStringDiv(new Date(),"yyMMdd");
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
return null;
}
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
// 获取月份(注意月份从0开始计数)
Integer month = calendar.get(Calendar.MONTH) + 1;
String key = warehouseCode+":ZFQS:"+dateShort;
//获得序号
Boolean exists = bladeRedis.exists(key);
Long incr = null;
if(exists){
incr = bladeRedis.incr(key);
}else{
String value = dateShort+"00001";
incr = Long.parseLong(value);
bladeRedis.set(key,incr);
bladeRedis.expireAt(key,CommonUtil.getDayEnd());
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);
}
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode+"ZFQS"+CommonUtil.geFourNumber(incr,5);
return warehouseCode+"ZFQS"+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(), 5);
}
@ -130,23 +144,39 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
}
String f = "ZZ";
String dateShort = CommonUtil.dateToStringDiv(new Date(),"yyMMdd");
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
return null;
}
String key = warehouseCode+f+":"+dateShort;
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
//获得序号
Boolean exists = bladeRedis.exists(key);
Long incr = null;
if(exists){
incr = bladeRedis.incr(key);
}else{
String value = dateShort+"00001";
incr = Long.parseLong(value);
bladeRedis.set(key,incr);
bladeRedis.expireAt(key,CommonUtil.getDayEnd());
// 获取月份(注意月份从0开始计数)
Integer 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);
}
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode+f+CommonUtil.geFourNumber(incr,5);
return warehouseCode+f+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(),5);
}
private String generateTrunklineCarsLineCode(Integer type, String warehouseCode, String orderCode) {
@ -165,24 +195,39 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
return null;
}
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
return null;
}
String dateShort = CommonUtil.dateToStringDiv(new Date(),"yyMMdd");
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
String key = warehouseCode+f+":"+dateShort;
// 获取月份(注意月份从0开始计数)
Integer month = calendar.get(Calendar.MONTH) + 1;
//获得序号
Boolean exists = bladeRedis.exists(key);
Long incr = null;
if(exists){
incr = bladeRedis.incr(key);
}else{
String value = dateShort+"00001";
incr = Long.parseLong(value);
bladeRedis.set(key,incr);
bladeRedis.expireAt(key,CommonUtil.getDayEnd());
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);
}
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
return warehouseCode+f+CommonUtil.geFourNumber(incr,5);
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode+f+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(), 5);
}
@ -191,25 +236,38 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
log.warn("############generateTrunklineBillladingCode: 仓库编码为空warehouseCode={}",warehouseCode);
return null;
}
//获得年月日短字符串
String dateShort = CommonUtil.dateToStringShort(new Date());
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
return null;
}
String key = warehouseCode+"TH"+":"+dateShort;
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
//获得序号
Boolean exists = bladeRedis.exists(key);
Long incr = null;
if(exists){
incr = bladeRedis.incr(key);
}else{
String value = dateShort+"00001";
incr = Long.parseLong(value);
bladeRedis.set(key,incr);
bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd());
// 获取月份(注意月份从0开始计数)
Integer 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);
}
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
return warehouseCode+"TH"+CommonUtil.geFourNumber(incr,5);
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode+"TH"+year+CommonUtil.geFourNumber(month.longValue(),2)+CommonUtil.geFourNumber(inrc.longValue(),5);
}
private String generateExOrderCode(Integer type, String warehouseCode, String orderCode) {
@ -220,17 +278,41 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
//HTEX+仓库code+年月日+(仓库当天的数量+1)
//获得年月日短字符串
String dateShort = CommonUtil.dateToStringShort(new Date());
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
return null;
}
String key = "HTEX"+":"+warehouseCode+":"+dateShort;
//获得序号
Long incr = bladeRedis.incr(key);
if(1 == incr){
//如果为1就是刚刚才建立,给他一个过期时间
bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd());
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
// 获取月份(注意月份从0开始计数)
Integer month = calendar.get(Calendar.MONTH) + 1;
// 获取日期
Integer day = calendar.get(Calendar.DAY_OF_MONTH);
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 "HTEX"+warehouseCode+CommonUtil.geFourNumber(incr,5);
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return "HTEX"+warehouseCode+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(day.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(),5);
}
private String generateTraysCode(Integer type, String warehouseCode) {
@ -240,42 +322,39 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
}
//托盘 HT+仓库拼音+ 年月 +【当前仓库总数+1(五位数 不足补零)】
//通过仓库编码获取仓库简写
BasicdataWarehouseEntity entity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(entity)){
log.warn("############generateTraysCode: 未找到对应仓库warehouseCode={}",warehouseCode);
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
return null;
}
// String abbreviation = entity.getAbbreviation();//简称
String code = entity.getWarehouseCode();
//获得年月日短字符串
// String dateShort = CommonUtil.dateToStringShortYM(new Date());
String key = "HT"+":"+code;
String HTCD = "HT" + code;
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
//获得序号
Long incr = bladeRedis.incr(key);
//托盘码查重
BasicdataTrayEntity basicdataTrayEntity = basicdataTrayMapper.selectOne(new QueryWrapper<BasicdataTrayEntity>().lambda()
.eq(BasicdataTrayEntity::getIsDeleted,0)
.like(BasicdataTrayEntity::getPalletCode,HTCD)
.orderByDesc(BasicdataTrayEntity::getCreateTime)
.last("limit 1"));
if (null!= basicdataTrayEntity){
int number2 = Integer.parseInt(basicdataTrayEntity.getPalletCode().substring(basicdataTrayEntity.getPalletCode().length() - 6));
if (number2>=incr){
//设置缓存
bladeRedis.set(key,Long.valueOf(number2+1));
return HTCD+CommonUtil.geFourNumber(Long.valueOf(number2+1), 6);
}
// 获取月份(注意月份从0开始计数)
Integer 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);
}
// if(1 == incr){
// //如果为1就是刚刚才建立,给他一个过期时间
// bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd());
// }
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
return HTCD+CommonUtil.geFourNumber(incr,6);
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return "HT"+warehouseCode+year+CommonUtil.geFourNumber(month.longValue(),2)+CommonUtil.geFourNumber(inrc.longValue(),5);
}
@ -299,10 +378,10 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
Calendar calendar = Calendar.getInstance();
//获取年份
int year = calendar.get(Calendar.YEAR);
Integer year = calendar.get(Calendar.YEAR);
// 获取月份(注意月份从0开始计数)
int month = calendar.get(Calendar.MONTH) + 1;
Integer month = calendar.get(Calendar.MONTH) + 1;
BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+"");
@ -320,7 +399,10 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
}
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
return warehouseCode+year+month+CommonUtil.geFourNumber(inrc.longValue(),5);
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode+year+CommonUtil.geFourNumber(month.longValue(),5)+CommonUtil.geFourNumber(inrc.longValue(),5);
}
@ -382,26 +464,38 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
//包条 HT+仓库拼音/超管/职能+年月日时分秒+订单索引+包条个数索引
String haxCodeByLong = CommonUtil.getHaxCodeByLong(orderCode, 8);
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
return null;
}
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
//获得年月日短字符串
Date date = new Date();
String dateShort = CommonUtil.dateToStringShort(date);
// 获取月份(注意月份从0开始计数)
Integer month = calendar.get(Calendar.MONTH) + 1;
//redis的key
String key = warehouseCode + ":" + haxCodeByLong+":"+dateShort;
//获得序号
Boolean exists = bladeRedis.exists(key);
Long incr = null;
if(exists){
incr = bladeRedis.incr(key);
}else{
String value = dateShort+"00001";
incr = Long.parseLong(value);
bladeRedis.set(key,incr);
bladeRedis.expireAt(key,CommonUtil.getMonthDayEnd());
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);
}
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return "HT" + warehouseCode + dateShort + haxCodeByLong + incr;
return "HT" + warehouseCode + year + CommonUtil.geFourNumber(month.longValue(),2) + haxCodeByLong + CommonUtil.geFourNumber(inrc.longValue(),6);
}
}

6
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/mapper/TrunklineLoadSignOrderMapper.xml

@ -31,9 +31,9 @@
<if test="param.signStatus != null and param.signStatus == '10'">
and ltlso.sign_status != '20'
</if>
<if test="param.driverId != null">
and ltcl.driver_id = #{param.driverId}
</if>
<!-- <if test="param.driverId != null">-->
<!-- and ltcl.driver_id = #{param.driverId}-->
<!-- </if>-->
</where>
</select>

24
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineCarsLoadServiceImpl.java

@ -2851,18 +2851,18 @@ public class TrunklineCarsLoadServiceImpl extends BaseServiceImpl<TrunklineCarsL
page.setCurrent(pageNum);
page.setSize(pageSize);
Long userId = AuthUtil.getUserId();
if(Objects.isNull(userId)){
log.warn("###############finaSignOrderList: 登录人id为空");
return R.fail(405,"登录人id为空");
}
BasicdataDriverArteryEntity driverArteryEntity = basicdataDriverArteryClient.getDriverArtery(userId);
if(Objects.isNull(driverArteryEntity)){
log.warn("###############finaSignOrderList: 未找到司机信息 userId={}",userId);
return R.fail(405,"未找到司机信息");
}
loadCarsDTO.setDriverId(driverArteryEntity.getId());
// Long userId = AuthUtil.getUserId();
// if(Objects.isNull(userId)){
// log.warn("###############finaSignOrderList: 登录人id为空");
// return R.fail(405,"登录人id为空");
// }
//
// BasicdataDriverArteryEntity driverArteryEntity = basicdataDriverArteryClient.getDriverArtery(userId);
// if(Objects.isNull(driverArteryEntity)){
// log.warn("###############finaSignOrderList: 未找到司机信息 userId={}",userId);
// return R.fail(405,"未找到司机信息");
// }
// loadCarsDTO.setDriverId(driverArteryEntity.getId());
IPage<TrunklineLoadSignOrderVO> pageList = trunklineLoadSignOrderService.finaSignOrderList(page,loadCarsDTO);

Loading…
Cancel
Save