Browse Source

1.修改包条码的生成规则

2.增加三方物料的结算品类
3.修复暂存单的包条打印
4.修改梦天工厂的数据回传保存
dist.1.3.0
pref_mail@163.com 8 months ago
parent
commit
4e19254f3b
  1. 11
      blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java
  2. 7
      blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java
  3. 1
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataCodeRecordEntity.java
  4. 3
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java
  5. 2
      blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayQRCode.java
  6. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.java
  7. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataCodeRecordMapper.xml
  8. 25
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataFactoryCategoryMapper.xml
  9. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml
  10. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeRecordService.java
  11. 2
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeService.java
  12. 4
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeRecordServiceImpl.java
  13. 415
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataCodeServiceImpl.java
  14. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java
  15. 2
      blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java
  16. 55
      blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java
  17. 102
      blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

11
blade-biz-common/src/main/java/org/springblade/common/utils/CommonUtil.java

@ -229,6 +229,15 @@ public class CommonUtil {
return preMonth;
}
/**
* 数字前面自动补零
* @param number 数字
* @return
*/
public static String geFourNumberByString(String number,int num){
return geFourNumber(Long.parseLong(number),num);
}
/**
* 数字前面自动补零
* @param number 数字
@ -259,6 +268,8 @@ public class CommonUtil {
}
public static Date getEndByDateStr(String endDate) {
try {
SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd");

7
blade-biz-common/src/main/java/org/springblade/common/utils/QRCodeUtil.java

@ -105,6 +105,11 @@ public class QRCodeUtil {
return null;
}
/**
* 条形码
* @param content
* @return
*/
public static String createCodeToFileType(String content) {
try {
//getResource("/")等同于到resource文件夹下
@ -167,7 +172,7 @@ public class QRCodeUtil {
hints.put(EncodeHintType.ERROR_CORRECTION, ErrorCorrectionLevel.M);
//EncodeHintType.MARGIN:设置二维码边距,单位像素,值越小,二维码距离四周越近
hints.put(EncodeHintType.MARGIN, 1);
hints.put(EncodeHintType.MARGIN, 0);
MultiFormatWriter multiFormatWriter = new MultiFormatWriter();
BitMatrix bitMatrix = multiFormatWriter.encode(content, BarcodeFormat.QR_CODE, CODE_WIDTH, CODE_HEIGHT, hints);

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

@ -18,6 +18,7 @@ public class BasicdataCodeRecordEntity extends TenantEntity {
private String warehouseCode;
private String year;
private String month;
private String day;
private Integer num;
}

3
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFactoryCategoryEntity.java

@ -64,6 +64,9 @@ public class BasicdataFactoryCategoryEntity extends TenantEntity {
@ApiModelProperty(value = "品牌id")
private Long brandId;
@ApiModelProperty(value = "结算类型 1 收入 2 成本")
private Integer type;

2
blade-service-api/logpm-warehouse-api/src/main/java/com/logpm/warehouse/vo/WarehouseTrayQRCode.java

@ -14,6 +14,8 @@ public class WarehouseTrayQRCode {
private String trayCode;
private String palletName;
public Map<String, Object> toMap() throws IllegalAccessException {
Map<String, Object> map = new HashMap<>();

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

@ -7,5 +7,5 @@ import org.apache.ibatis.annotations.Param;
@Mapper
public interface BasicdataCodeRecordMapper extends BaseMapper<BasicdataCodeRecordEntity> {
BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(@Param("type") Integer type, @Param("warehouseCode") String warehouseCode, @Param("year") String year, @Param("month") String month);
BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(@Param("type") Integer type, @Param("warehouseCode") String warehouseCode, @Param("year") String year, @Param("month") String month,@Param("day") String day);
}

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

@ -10,6 +10,7 @@
and warehouse_code = #{warehouseCode}
and `year` = #{year}
and `month` = #{month}
and `day` = #{day}
</select>
</mapper>

25
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataFactoryCategoryMapper.xml

@ -7,8 +7,23 @@
from logpm_basicdata_factory_category
where 1=1
and is_deleted = 0
<if test="param.brand != null and param.brand != ''">
and brand = #{param.brand}
<if test="param.type != null ">
and type = #{param.type}
</if>
<if test="param.category != null and param.category != ''">
and category = #{param.category}
</if>
<if test="param.firsts != null and param.firsts != ''">
and firsts = #{param.firsts}
</if>
<if test="param.seconds != null and param.seconds != ''">
and seconds = #{param.seconds}
</if>
<if test="param.thirds != null and param.thirds != ''">
and thirds = #{param.thirds}
</if>
</select>
@ -18,6 +33,12 @@
where 1=1
and brand = #{param.brand}
and is_deleted = 0
<if test="param.type != null and param.type != ''">
and type = #{param.type}
</if>
<if test="param.category != null and param.category != ''">
and category = #{param.category}
</if>
<if test="param.firsts == null or param.firsts == ''">
and (firsts is null or firsts = '')
</if>

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataTrayMapper.xml

@ -414,7 +414,7 @@
<select id="getTray" resultType="com.logpm.warehouse.vo.WarehouseTrayQRCode">
SELECT lwt.pallet_code trayCode ,lww.name warehouseName from logpm_warehouse_tray lwt LEFT JOIN logpm_warehouse_warehouse lww on lww.id =lwt.warehouse_id where lwt.id = #{id}
SELECT lwt.pallet_code trayCode ,lww.name warehouseName,lwt.pallet_name from logpm_warehouse_tray lwt LEFT JOIN logpm_warehouse_warehouse lww on lww.id =lwt.warehouse_id where lwt.id = #{id}
</select>

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

@ -4,5 +4,5 @@ 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);
BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(Integer type, String warehouseCode, String year, String month,String day);
}

2
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataCodeService.java

@ -6,5 +6,5 @@ public interface IBasicdataCodeService {
String getCodeByType(Integer type,String warehouseCode,String orderCode);
List<String> getBatchPackageCodeByType(String warehouseCode, String orderCode, Integer num);
List<String> getBatchPackageCodeByType(String warehouseCode, String orderCode, Integer num) ;
}

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

@ -13,7 +13,7 @@ import org.springframework.stereotype.Service;
@AllArgsConstructor
public class BasicdataCodeRecordServiceImpl extends BaseServiceImpl<BasicdataCodeRecordMapper, BasicdataCodeRecordEntity> implements IBasicdataCodeRecordService {
@Override
public BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(Integer type, String warehouseCode, String year, String month) {
return baseMapper.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year,month);
public BasicdataCodeRecordEntity findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(Integer type, String warehouseCode, String year, String month,String day) {
return baseMapper.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year,month,day);
}
}

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

@ -7,6 +7,7 @@ import com.logpm.basicdata.entity.BasicdataWarehouseEntity;
import com.logpm.basicdata.service.IBasicdataCodeRecordService;
import com.logpm.basicdata.service.IBasicdataCodeService;
import com.logpm.basicdata.service.IBasicdataWarehouseService;
import io.swagger.models.auth.In;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.CodeDesEnum;
@ -38,15 +39,16 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
/**
* 根据类型生成编号
*
* @param type
* @return
*/
@Override
public String getCodeByType(Integer type,String warehouseCode,String orderCode) {
public String getCodeByType(Integer type, String warehouseCode, String orderCode) {
String code = null;
switch (type){
switch (type) {
case CodeNumConstant.WAYBILL:
code = getWayBillNo(type,warehouseCode);
code = getWayBillNo(type, warehouseCode);
break;
// case CodeNumConstant.ORDER:
// break;
@ -58,11 +60,11 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
// case CodeNumConstant.LOCATION:
// break;
case CodeNumConstant.TRAYS:
code = generateTraysCode(type,warehouseCode);
code = generateTraysCode(type, warehouseCode);
break;
case CodeNumConstant.PACKAGE:
//包件号
code = generatePackageCode(type,warehouseCode,orderCode);
code = generatePackageCode(type, warehouseCode, orderCode);
break;
// case CodeNumConstant.SHELF:
// break;
@ -70,22 +72,22 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
// code = generateDeliveryCustomOrder(type,warehouseCode);
// break;
case CodeNumConstant.ABNORMAL_ORDER:
code = generateExOrderCode(type,warehouseCode,orderCode);
code = generateExOrderCode(type, warehouseCode, orderCode);
break;
case CodeNumConstant.TRUNKLINEBILLLADING:
code = generateTrunklineBillladingCode(type,warehouseCode,orderCode);
code = generateTrunklineBillladingCode(type, warehouseCode, orderCode);
break;
case CodeNumConstant.TRUNKLINE_CARS_LOAD:
code = generateTrunklineCarsLineCode(type,warehouseCode,orderCode);
code = generateTrunklineCarsLineCode(type, warehouseCode, orderCode);
break;
case CodeNumConstant.TRUNKLINE_TRIPARTITE_LOAD:
code = generateTrunklineTripartiteLoadCode(type,warehouseCode,orderCode);
code = generateTrunklineTripartiteLoadCode(type, warehouseCode, orderCode);
break;
case CodeNumConstant.TRUNKLINE_LOAD_SIGN:
code = generateTrunklineLoadSignCode(type,warehouseCode,orderCode);
code = generateTrunklineLoadSignCode(type, warehouseCode, orderCode);
break;
case CodeNumConstant.BALANCE_ORDER:
code = generateBalanceOrderCode(type,warehouseCode,orderCode);
code = generateBalanceOrderCode(type, warehouseCode, orderCode);
break;
default:
log.info("##################getCodeByType: 暂不支持的编码类型 type={}", CodeDesEnum.getMes(type));
@ -94,36 +96,23 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
}
private String generateBalanceOrderCode(Integer type, String warehouseCode, String orderCode) {
if(!"BALANCE_ORDER".equals(warehouseCode)){
log.warn("#########generateBalanceOrderCode: 仓库编码有误 warehouseCode={}",warehouseCode);
if (!"BALANCE_ORDER".equals(warehouseCode)) {
log.warn("#########generateBalanceOrderCode: 仓库编码有误 warehouseCode={}", warehouseCode);
return null;
}
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;
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(CodeNumConstant.PACKAGE,warehouseCode,year+"",month+"");
if(Objects.isNull(basicdataCodeRecordEntity)){
basicdataCodeRecordEntity = new BasicdataCodeRecordEntity();
basicdataCodeRecordEntity.setCodeType(CodeNumConstant.PACKAGE);
basicdataCodeRecordEntity.setWarehouseName("全仓");
basicdataCodeRecordEntity.setWarehouseCode(warehouseCode);
basicdataCodeRecordEntity.setYear(year+"");
basicdataCodeRecordEntity.setMonth(month+"");
basicdataCodeRecordEntity.setNum(0);
basicdataCodeRecordService.save(basicdataCodeRecordEntity);
}
Integer oldNum = basicdataCodeRecordEntity.getNum();
oldNum = oldNum + 1;
String packageCode = "JSD" + year + CommonUtil.geFourNumber(month.longValue(),2) + CommonUtil.geFourNumber(oldNum.longValue(),6);
String packageCode = "JSD" + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(oldNum.longValue(), 6);
basicdataCodeRecordEntity.setNum(oldNum);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
@ -131,52 +120,38 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
}
@Override
public List<String> getBatchPackageCodeByType(String warehouseCode, String orderCode, Integer num) {
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############getBatchPackageCodeByType: 仓库编码为空warehouseCode={}",warehouseCode);
public List<String> getBatchPackageCodeByType(String warehouseCode, String orderCode, Integer num) {
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############getBatchPackageCodeByType: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
if(!StringUtil.hasLength(orderCode)){
log.warn("############getBatchPackageCodeByType: 订单号为空orderCode={}",orderCode);
if (!StringUtil.hasLength(orderCode)) {
log.warn("############getBatchPackageCodeByType: 订单号为空orderCode={}", orderCode);
return null;
}
//包条 HT+仓库拼音/超管/职能+年月日时分秒+订单索引+包条个数索引
String haxCodeByLong = CommonUtil.getHaxCodeByLong(orderCode, 8);
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
if (Objects.isNull(basicdataWarehouseEntity)) {
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode);
return null;
}
//包条 HT+仓库拼音/超管/职能+年月日时分秒+订单索引+包条个数索引CodeNumConstant.PACKAGE
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(CodeDesEnum.PACKAGE.getCodeNum(), basicdataWarehouseEntity);
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
// 获取月份(注意月份从0开始计数)
Integer month = calendar.get(Calendar.MONTH) + 1;
BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(CodeNumConstant.PACKAGE,warehouseCode,year+"",month+"");
if(Objects.isNull(basicdataCodeRecordEntity)){
basicdataCodeRecordEntity = new BasicdataCodeRecordEntity();
basicdataCodeRecordEntity.setCodeType(CodeNumConstant.PACKAGE);
basicdataCodeRecordEntity.setWarehouseId(basicdataWarehouseEntity.getId());
basicdataCodeRecordEntity.setWarehouseName(basicdataWarehouseEntity.getName());
basicdataCodeRecordEntity.setWarehouseCode(warehouseCode);
basicdataCodeRecordEntity.setYear(year+"");
basicdataCodeRecordEntity.setMonth(month+"");
basicdataCodeRecordEntity.setNum(0);
basicdataCodeRecordService.save(basicdataCodeRecordEntity);
}
Integer oldNum = basicdataCodeRecordEntity.getNum();
List<String> packageCodes = new ArrayList<>();
int year =Integer.parseInt(basicdataCodeRecordEntity.getYear())%100;
for (int i = 0; i < num; i++) {
//获取时间戳后面的时分秒
try {
Thread.sleep(1);
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
String time = new String(System.currentTimeMillis() + "");
time=time.substring(4);
oldNum = oldNum + 1;
String packageCode = "HT" + warehouseCode + year + CommonUtil.geFourNumber(month.longValue(),2) + haxCodeByLong + CommonUtil.geFourNumber(oldNum.longValue(),6);
String packageCode = "HT" + warehouseCode + year + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + basicdataCodeRecordEntity.getDay() + time;
packageCodes.add(packageCode);
}
basicdataCodeRecordEntity.setNum(oldNum);
@ -187,328 +162,231 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
private String generateTrunklineLoadSignCode(Integer type, String warehouseCode, String orderCode) {
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############generateTrunklineLoadSignCode: 仓库编码为空warehouseCode={}",warehouseCode);
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############generateTrunklineLoadSignCode: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
if (Objects.isNull(basicdataWarehouseEntity)) {
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode);
return null;
}
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode + "ZFQS" + basicdataCodeRecordEntity.getYear() + basicdataCodeRecordEntity.getMonth() + CommonUtil.geFourNumber(inrc.longValue(), 5);
}
/**
* 获取编码生成记录
*
* @param type
* @param basicdataWarehouseEntity
* @return
*/
private BasicdataCodeRecordEntity getBasicdataCodeRecordEntity(Integer type, BasicdataWarehouseEntity basicdataWarehouseEntity) {
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, basicdataWarehouseEntity.getWarehouseCode(), year + "", month + "", day + "");
BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+"");
if(Objects.isNull(basicdataCodeRecordEntity)){
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.setWarehouseCode(basicdataWarehouseEntity.getWarehouseCode());
basicdataCodeRecordEntity.setYear(year + "");
basicdataCodeRecordEntity.setMonth(month + "");
basicdataCodeRecordEntity.setDay(day + "");
basicdataCodeRecordEntity.setNum(0);
basicdataCodeRecordService.save(basicdataCodeRecordEntity);
}
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode+"ZFQS"+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(), 5);
return basicdataCodeRecordEntity;
}
private String generateTrunklineTripartiteLoadCode(Integer type, String warehouseCode, String orderCode) {
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############generateTrunklineCarsLineCode: 仓库编码为空warehouseCode={}",warehouseCode);
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############generateTrunklineCarsLineCode: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
String f = "ZZ";
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",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;
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);
}
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode+f+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(),5);
return warehouseCode + f + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5);
}
private String generateTrunklineCarsLineCode(Integer type, String warehouseCode, String orderCode) {
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############generateTrunklineCarsLineCode: 仓库编码为空warehouseCode={}",warehouseCode);
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############generateTrunklineCarsLineCode: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
String f = "";
if("1".equals(orderCode)){
if ("1".equals(orderCode)) {
f = "GX";
}else if ("2".equals(orderCode)){
} else if ("2".equals(orderCode)) {
f = "ZX";
}else if ("3".equals(orderCode)){
} else if ("3".equals(orderCode)) {
f = "ZC";
}else {
} else {
return null;
}
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",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;
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
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+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(), 5);
return warehouseCode + f + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5);
}
private String generateTrunklineBillladingCode(Integer type, String warehouseCode, String orderCode) {
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############generateTrunklineBillladingCode: 仓库编码为空warehouseCode={}",warehouseCode);
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############generateTrunklineBillladingCode: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",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;
BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+"");
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
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+"TH"+year+CommonUtil.geFourNumber(month.longValue(),2)+CommonUtil.geFourNumber(inrc.longValue(),5);
return warehouseCode + "TH" + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5);
}
private String generateExOrderCode(Integer type, String warehouseCode, String orderCode) {
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############generateTraysCode: 仓库编码为空warehouseCode={}",warehouseCode);
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############generateTraysCode: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
//HTEX+仓库code+年月日+(仓库当天的数量+1)
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",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;
// 获取日期
Integer day = calendar.get(Calendar.DAY_OF_MONTH);
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
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 "HTEX"+warehouseCode+year+CommonUtil.geFourNumber(month.longValue(), 2)+CommonUtil.geFourNumber(day.longValue(), 2)+CommonUtil.geFourNumber(inrc.longValue(),5);
return "HTEX" + warehouseCode + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getDay(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5);
}
private String generateTraysCode(Integer type, String warehouseCode) {
BasicTenantCodeEntity basicTenantCode = tenantCodeClient.findBasicTenantCodeByCodeAndShowType(BasicCodeTypeConstant.TRAY_CODE.getValue(), BasicCodeShowConstant.QR_CODE.getValue());
if(Objects.isNull(basicTenantCode)){
log.warn("############generateTraysCode: 租户信息不存在basicTenantCode={}",basicTenantCode);
if (Objects.isNull(basicTenantCode)) {
log.warn("############generateTraysCode: 租户信息不存在basicTenantCode={}", basicTenantCode);
return null;
}
String desName = basicTenantCode.getDesName();
String code = basicTenantCode.getCode();
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############generateTraysCode: 仓库编码为空warehouseCode={}",warehouseCode);
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############generateTraysCode: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
//托盘 HT+仓库拼音+ 年月 +【当前仓库总数+1(五位数 不足补零)】
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",warehouseCode);
if (Objects.isNull(basicdataWarehouseEntity)) {
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}", warehouseCode);
return null;
}
String abbreviation = basicdataWarehouseEntity.getAbbreviation();
Calendar calendar = Calendar.getInstance();
//获取年份
Integer year = calendar.get(Calendar.YEAR);
// 获取月份(注意月份从0开始计数)
Integer month = calendar.get(Calendar.MONTH) + 1;
BasicdataCodeRecordEntity basicdataCodeRecordEntity = basicdataCodeRecordService.findEntityByCodeTypeAndWarehouseCodeAndYearAndMonth(type,warehouseCode,year+"",month+"");
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
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(100000);
basicdataCodeRecordService.save(basicdataCodeRecordEntity);
}
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
String trayCode = code+ warehouseCode + (year%100) + inrc;
String trayCode = code + warehouseCode + (Integer.parseInt(basicdataCodeRecordEntity.getYear()) % 100) + inrc;
String trayName = desName + abbreviation + inrc;
return trayCode+"&&"+trayName;
return trayCode + "&&" + trayName;
}
/**
* 生成仓库对应的运单号
*
* @param type
* @param warehouseCode
* @return
*/
private String getWayBillNo(Integer type, String warehouseCode) {
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############getWayBillNo: 仓库编码为空warehouseCode={}",warehouseCode);
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############getWayBillNo: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",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;
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);
}
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return warehouseCode+year+CommonUtil.geFourNumber(month.longValue(),2)+CommonUtil.geFourNumber(inrc.longValue(),5);
return warehouseCode + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + CommonUtil.geFourNumber(inrc.longValue(), 5);
}
@ -521,22 +399,23 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
String tenantCode = basicTenantCodeClient.shelfCode(tenantId, String.valueOf(type));//租户编码
//获得年月日短字符串
String dateShort = CommonUtil.dateToStringShort(new Date());
String key = tenantId + ":" + warehouseCode + ":" + des+":"+dateShort;
String key = tenantId + ":" + warehouseCode + ":" + des + ":" + dateShort;
//获得序号
Long incr = bladeRedis.incr(key);
if(1 == incr){
if (1 == incr) {
//如果为1就是刚刚才建立,给他一个过期时间
bladeRedis.expireAt(key,CommonUtil.getDayEnd());
bladeRedis.expireAt(key, CommonUtil.getDayEnd());
}
return tenantCode+warehouseCode+dateShort+CommonUtil.geFourNumber(incr,5);
return tenantCode + warehouseCode + dateShort + CommonUtil.geFourNumber(incr, 5);
}
/**
* 生成配送车次号编码
*
* @param type
*/
private String generateDeliveryTrainNumber(Integer type,String warehouseCode) {
private String generateDeliveryTrainNumber(Integer type, String warehouseCode) {
String des = CodeDesEnum.getMes(type);//摘要
String tenantId = AuthUtil.getTenantId();//租户号
// String tenantId = "627683";//租户号
@ -545,25 +424,25 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
String dateShort = CommonUtil.dateToStringShort(new Date());
//redis的key
String key = tenantId + ":" + warehouseCode + ":" + des+":"+dateShort;
String key = tenantId + ":" + warehouseCode + ":" + des + ":" + dateShort;
//获得序号
Long incr = bladeRedis.incr(key);
if(1 == incr){
if (1 == incr) {
//如果为1就是刚刚才建立,给他一个过期时间
bladeRedis.expireAt(key,CommonUtil.getDayEnd());
bladeRedis.expireAt(key, CommonUtil.getDayEnd());
}
return warehouseCode + des + dateShort + CommonUtil.geFourNumber(incr,5);
return warehouseCode + des + dateShort + CommonUtil.geFourNumber(incr, 5);
}
private String generatePackageCode(Integer type,String warehouseCode,String orderCode) {
if(!StringUtil.hasLength(warehouseCode)){
log.warn("############generatePackageCode: 仓库编码为空warehouseCode={}",warehouseCode);
private String generatePackageCode(Integer type, String warehouseCode, String orderCode) {
if (!StringUtil.hasLength(warehouseCode)) {
log.warn("############generatePackageCode: 仓库编码为空warehouseCode={}", warehouseCode);
return null;
}
if(!StringUtil.hasLength(orderCode)){
log.warn("############generatePackageCode: 订单号为空orderCode={}",orderCode);
if (!StringUtil.hasLength(orderCode)) {
log.warn("############generatePackageCode: 订单号为空orderCode={}", orderCode);
return null;
}
@ -571,37 +450,17 @@ public class BasicdataCodeServiceImpl implements IBasicdataCodeService {
String haxCodeByLong = CommonUtil.getHaxCodeByLong(orderCode, 8);
BasicdataWarehouseEntity basicdataWarehouseEntity = basicdataWarehouseService.getWarehouseEntityByWarehouseCode(warehouseCode);
if(Objects.isNull(basicdataWarehouseEntity)){
log.warn("############getWayBillNo: 仓库信息不存在 warehouseCode={}",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;
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);
}
BasicdataCodeRecordEntity basicdataCodeRecordEntity = getBasicdataCodeRecordEntity(type, basicdataWarehouseEntity);
Integer inrc = basicdataCodeRecordEntity.getNum() + 1;
basicdataCodeRecordEntity.setNum(inrc);
basicdataCodeRecordService.updateById(basicdataCodeRecordEntity);
return "HT" + warehouseCode + year + CommonUtil.geFourNumber(month.longValue(),2) + haxCodeByLong + CommonUtil.geFourNumber(inrc.longValue(),6);
return "HT" + warehouseCode + basicdataCodeRecordEntity.getYear() + CommonUtil.geFourNumberByString(basicdataCodeRecordEntity.getMonth(), 2) + haxCodeByLong + CommonUtil.geFourNumber(inrc.longValue(), 6);
}
}

1
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataTrayServiceImpl.java

@ -228,6 +228,7 @@ public class BasicdataTrayServiceImpl extends BaseServiceImpl<BasicdataTrayMappe
Map<String, Object> map = JSONObject.parseObject(JSONObject.toJSONString(trayQRCode), Map.class);
String filename = QRCodeUtil.createCodeToFile(trayQRCode.getTrayCode());
map.put("qrCode", QRCodeUtil.getEmpAutograph(filename));
map.put("palletName", trayQRCode.getPalletName());
String fileTypeName = QRCodeUtil.createCodeToFileType(trayQRCode.getTrayCode());
map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName));
map.put("tenant","汇通物流");

2
blade-service/logpm-factory/src/main/java/com/logpm/factory/mt/service/impl/MtFactoryDataServiceImpl.java

@ -715,7 +715,7 @@ public class MtFactoryDataServiceImpl implements IMtFactoryDataService {
Integer PUSH_STATUS_FAIL = 2;
JSONObject jsonObject = JSONObject.parseObject(result);
if (jsonObject == null || jsonObject.isEmpty() || 0 != jsonObject.getInteger("code")) {
if (jsonObject == null || jsonObject.isEmpty() || 0 != jsonObject.getInteger("Result")) {
mtOrderLogEntity.setPushStatus(PUSH_STATUS_FAIL);
} else {
mtOrderLogEntity.setPushStatus(PUSH_STATUS_SUCCESS);

55
blade-service/logpm-factory/src/test/java/com/logpm/factory/TestService.java

@ -62,6 +62,7 @@ import org.springblade.core.redis.cache.BladeRedis;
import org.springblade.core.test.BladeBootTest;
import org.springblade.core.test.BladeSpringExtension;
import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.SpringUtil;
import org.springblade.core.tool.utils.StringUtil;
import org.springblade.resource.feign.IOssClient;
@ -76,6 +77,7 @@ import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.commons.CommonsMultipartFile;
import javax.crypto.spec.PSource;
import javax.xml.crypto.Data;
import java.io.*;
import java.nio.charset.StandardCharsets;
import java.security.NoSuchAlgorithmException;
@ -1100,34 +1102,43 @@ public class TestService {
public static void main(String[] args) throws IOException, InterruptedException {
Date data1 = DateUtil.parse("2024-07-23 17:07:23.123","yyyy-MM-dd hh:mm:ss.SSS");
Date data2 = DateUtil.parse("2024-07-24 17:07:23.123","yyyy-MM-dd hh:mm:ss.SSS");
File file = new File("D:\\新建文件夹\\444.txt");
System.out.println(data1.getTime());
System.out.println(data2.getTime());
BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
List<String> list = new ArrayList<>();
while (bufferedReader.ready()) {
String line = bufferedReader.readLine();
if(!list.contains(line)){
list.add(line);
System.out.println(line);
}
}
// 获取token
String s = buildToken();
for (String string : list) {
Thread.sleep(500);
System.out.println(string);
String url = "https://timsapi.oppein.com/tims_odata_api/api/odata/PackageFeedbackRecord";
HttpResponse httpResponse = HttpRequest.post(url).header("Authorization", s).body(string).execute();
String result = httpResponse.body();
System.out.println(result);
}
// File file = new File("D:\\新建文件夹\\444.txt");
//
// BufferedReader bufferedReader = new BufferedReader(new FileReader(file));
//
// List<String> list = new ArrayList<>();
//
// while (bufferedReader.ready()) {
// String line = bufferedReader.readLine();
// if(!list.contains(line)){
// list.add(line);
// System.out.println(line);
// }
// }
//
// // 获取token
// String s = buildToken();
//
//
//
// for (String string : list) {
// Thread.sleep(500);
// System.out.println(string);
// String url = "https://timsapi.oppein.com/tims_odata_api/api/odata/PackageFeedbackRecord";
// HttpResponse httpResponse = HttpRequest.post(url).header("Authorization", s).body(string).execute();
// String result = httpResponse.body();
// System.out.println(result);
// }
}

102
blade-service/logpm-trunkline/src/main/java/com/logpm/trunkline/service/impl/TrunklineAdvanceDetailServiceImpl.java

@ -53,16 +53,16 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
private final IWarehouseWaybillClient warehouseWaybillClient;
@Override
public void updatePackageStatusById(String packageStatus, Long advanceDetailId,Long warehouseId,String warehouseName,Date incomingTime) {
baseMapper.updatePackageStatusById(packageStatus,advanceDetailId,warehouseId,warehouseName,incomingTime);
public void updatePackageStatusById(String packageStatus, Long advanceDetailId, Long warehouseId, String warehouseName, Date incomingTime) {
baseMapper.updatePackageStatusById(packageStatus, advanceDetailId, warehouseId, warehouseName, incomingTime);
}
@Override
public TrunklineAdvanceDetailEntity findEntityByOrderPackageCodeAndWarehouseId(String orderPackageCode, Long warehouseId) {
QueryWrapper<TrunklineAdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_package_code",orderPackageCode)
.eq("warehouse_id",warehouseId)
.eq("is_deleted",0);
queryWrapper.eq("order_package_code", orderPackageCode)
.eq("warehouse_id", warehouseId)
.eq("is_deleted", 0);
return baseMapper.selectOne(queryWrapper);
}
@ -93,7 +93,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
page.setCurrent(advanceDetailDTO.getPageNum());
page.setSize(advanceDetailDTO.getPageSize());
IPage<TrunklineAdvanceDetailVO> pageList = baseMapper.advanceDetailPageList(page,advanceDetailDTO);
IPage<TrunklineAdvanceDetailVO> pageList = baseMapper.advanceDetailPageList(page, advanceDetailDTO);
return pageList;
}
@ -101,7 +101,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public TrunklineAdvanceDetailEntity findEntityByOrderPackageCode(String orderPackageCode) {
QueryWrapper<TrunklineAdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_package_code",orderPackageCode);
queryWrapper.eq("order_package_code", orderPackageCode);
return baseMapper.selectOne(queryWrapper);
}
@ -113,10 +113,10 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public TrunklineAdvanceDetailEntity findEntityByOrderPackageCodeAndTrainNumberAndServiceNumAndOrderCode(String orderPackageCode, String trainNumber, String serviceNum, String orderCode) {
QueryWrapper<TrunklineAdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("order_package_code",orderPackageCode)
.eq("order_code",orderCode)
.eq("train_number",trainNumber)
.eq("service_num",serviceNum);
queryWrapper.eq("order_package_code", orderPackageCode)
.eq("order_code", orderCode)
.eq("train_number", trainNumber)
.eq("service_num", serviceNum);
return baseMapper.selectOne(queryWrapper);
}
@ -129,6 +129,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
public OrderPackgeCodeDataVO showAdvancePackgeCode(Map<String, Object> params) throws Exception {
OrderPackgeCodeDataVO orderPackgeCodeDataVO = new OrderPackgeCodeDataVO();
List<Map> data = new ArrayList<>();
List<String> values = new ArrayList<>();
BasicPrintTemplateEntity template = basicPrintTemplateClient.getPrintTemplate(PrintTemplateStatusConstant.daiqueren_10.getValue());
if (ObjectUtil.isEmpty(template)) {
throw new ServiceException("模板内容未找到");
@ -140,14 +141,14 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
String orderPackageCodes = (String) params.get("orderPackageCodes");
String[] idArray = orderPackageCodes.split(",");
if(ObjectUtils.isNull(idArray)){
if (ObjectUtils.isNull(idArray)) {
throw new ServiceException("参数错误");
}
for (String orderPackageCode : idArray) {
DistributionStockArticleQRCodeVO vo = new DistributionStockArticleQRCodeVO();
DistributionStockArticleQRCodeVO vo = new DistributionStockArticleQRCodeVO();
TrunklineAdvanceDetailEntity advanceDetailEntity = baseMapper.findEntityByOrderPackageCodelimit1(orderPackageCode);
if(!Objects.isNull(advanceDetailEntity)){
if (!Objects.isNull(advanceDetailEntity)) {
Long advanceId = advanceDetailEntity.getAdvanceId();
TrunklineAdvanceEntity advanceEntity = advanceMapper.selectById(advanceId);
@ -158,18 +159,18 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
String thirdPackName = advanceDetailEntity.getThirdPackName();
if(!Objects.isNull(waybillId)){
if (!Objects.isNull(waybillId)) {
WarehouseWaybillEntity waybillEntity = warehouseWaybillClient.findByWaybillId(waybillId);
if(!Objects.isNull(waybillEntity)){
vo.setShipperName(StringUtil.isBlank(waybillEntity.getShipper())?"":waybillEntity.getShipper());
vo.setShipperAddress(StringUtil.isBlank(waybillEntity.getShipperAddress())?"":waybillEntity.getShipperAddress());
vo.setMallName(StringUtil.isBlank(waybillEntity.getConsignee())?"":waybillEntity.getConsignee());
vo.setWaybillsNum(waybillEntity.getTotalCount()+"");
vo.setObjective(StringUtil.isBlank(waybillEntity.getDestinationWarehouseName())?"":waybillEntity.getDestinationWarehouseName());
vo.setDepartureStation(StringUtil.isBlank(waybillEntity.getDepartureWarehouseName())?"":waybillEntity.getDepartureWarehouseName());
vo.setWaybillNumber(StringUtil.isBlank(waybillEntity.getWaybillNo())?"":waybillEntity.getWaybillNo());
if (!Objects.isNull(waybillEntity)) {
vo.setShipperName(StringUtil.isBlank(waybillEntity.getShipper()) ? "" : waybillEntity.getShipper());
vo.setShipperAddress(StringUtil.isBlank(waybillEntity.getShipperAddress()) ? "" : waybillEntity.getShipperAddress());
vo.setMallName(StringUtil.isBlank(waybillEntity.getConsignee()) ? "" : waybillEntity.getConsignee());
vo.setWaybillsNum(waybillEntity.getTotalCount() + "");
vo.setObjective(StringUtil.isBlank(waybillEntity.getDestinationWarehouseName()) ? "" : waybillEntity.getDestinationWarehouseName());
vo.setDepartureStation(StringUtil.isBlank(waybillEntity.getDepartureWarehouseName()) ? "" : waybillEntity.getDepartureWarehouseName());
vo.setWaybillNumber(StringUtil.isBlank(waybillEntity.getWaybillNo()) ? "" : waybillEntity.getWaybillNo());
}
}else{
} else {
vo.setShipperName("");
vo.setShipperAddress("");
vo.setMallName("");
@ -180,22 +181,22 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
}
vo.setOrderCode(orderCode);
vo.setCustomerName(StringUtil.isBlank(advanceEntity.getCustomerName())?"":advanceEntity.getCustomerName());
vo.setCustomerTelephone(StringUtil.isBlank(advanceEntity.getCustomerPhone())?"":advanceEntity.getCustomerPhone());
vo.setCustomerAddress(StringUtil.isBlank(advanceEntity.getCustomerAddress())?"":advanceEntity.getCustomerAddress());
vo.setMaterialName(StringUtil.isBlank(advanceDetailEntity.getMaterialName())?"":advanceDetailEntity.getMaterialName());
vo.setCategory(firstPackName+"/"+secondPackName+"/"+thirdPackName);
vo.setDealerCode(StringUtil.isBlank(advanceEntity.getDealerCode())?"":advanceEntity.getDealerCode());
vo.setDealerName(StringUtil.isBlank(advanceEntity.getDealerName())?"":advanceEntity.getDealerName());
vo.setCustomerName(StringUtil.isBlank(advanceEntity.getCustomerName()) ? "" : advanceEntity.getCustomerName());
vo.setCustomerTelephone(StringUtil.isBlank(advanceEntity.getCustomerPhone()) ? "" : advanceEntity.getCustomerPhone());
vo.setCustomerAddress(StringUtil.isBlank(advanceEntity.getCustomerAddress()) ? "" : advanceEntity.getCustomerAddress());
vo.setMaterialName(StringUtil.isBlank(advanceDetailEntity.getMaterialName()) ? "" : advanceDetailEntity.getMaterialName());
vo.setCategory(firstPackName + "/" + secondPackName + "/" + thirdPackName);
vo.setDealerCode(StringUtil.isBlank(advanceEntity.getDealerCode()) ? "" : advanceEntity.getDealerCode());
vo.setDealerName(StringUtil.isBlank(advanceEntity.getDealerName()) ? "" : advanceEntity.getDealerName());
vo.setQrCode(orderPackageCode);
vo.setTotalNumber(advanceEntity.getTotalNum()+"");
vo.setTotalNumber(advanceEntity.getTotalNum() + "");
}
//把vo转成Map<String, Object>
Map<String, Object> map = BeanUtil.beanToMap(vo);
if(!Objects.isNull(advanceDetailEntity)){
map.put("id",advanceDetailEntity.getId());
if (!Objects.isNull(advanceDetailEntity)) {
map.put("id", advanceDetailEntity.getId());
}
String filename = QRCodeUtil.createCodeToFile(vo.getQrCode());
map.put("img", QRCodeUtil.getEmpAutograph(filename));
@ -203,9 +204,14 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
String fileTypeName = QRCodeUtil.createCodeToFile(vo.getQrCode());
map.put("imgType", QRCodeUtil.getEmpAutograph(fileTypeName));
data.add(map);
String tempData = TemplateUtil.popTemplate(template.getTemplateName(), map, orderPackgeCodeDataVO.getTemplateHtml());
values.add(tempData);
}
orderPackgeCodeDataVO.setDataList(data);
orderPackgeCodeDataVO.setMoldList(values);
// TemplateUtil.popTemplate(template.getTemplateName(),data,orderPackgeCodeDataVO.getTemplateHtml())
return orderPackgeCodeDataVO;
}
@ -213,7 +219,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public List<TrunklineAdvanceDetailEntity> findListByAdvanceId(Long advanceId) {
QueryWrapper<TrunklineAdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("advance_id",advanceId);
queryWrapper.eq("advance_id", advanceId);
return baseMapper.selectList(queryWrapper);
}
@ -225,8 +231,8 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public void deleteByAdvanceId(Long advanceId) {
QueryWrapper<TrunklineAdvanceDetailEntity> queryWrapper = new QueryWrapper<>();
queryWrapper.eq("advance_id",advanceId)
.eq("is_deleted",0);
queryWrapper.eq("advance_id", advanceId)
.eq("is_deleted", 0);
baseMapper.delete(queryWrapper);
}
@ -241,12 +247,12 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
//判断暂存单下还有没有包件
List<String> strings = baseMapper.findOrderPackageCodesByAdvanceId(advanceId);
if(0 == strings.size()){
if (0 == strings.size()) {
//删除暂存单
List<Long> advanceIds = new ArrayList<>();
advanceIds.add(advanceId);
advanceMapper.deletedAdvance(advanceIds);
}else{
} else {
//数量减一
advanceMapper.subTotalNumByAdvanceId(advanceId);
}
@ -263,7 +269,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public void updateWaybillNoByAdvanceId(Long advanceId, String waybillNo, Long waybillId) {
baseMapper.updateWaybillNoByAdvanceId(advanceId,waybillNo,waybillId);
baseMapper.updateWaybillNoByAdvanceId(advanceId, waybillNo, waybillId);
}
@Override
@ -278,23 +284,23 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public Integer findListByAdvanceIdAndPackageStatus(Long advanceId, String packageStatus) {
return baseMapper.findListByAdvanceIdAndPackageStatus(advanceId,packageStatus);
return baseMapper.findListByAdvanceIdAndPackageStatus(advanceId, packageStatus);
}
@Override
public Map<String, String> findPackageCodeByCodes(Set<String> orderPackageCodes) {
@Override
public Map<String, String> findPackageCodeByCodes(Set<String> orderPackageCodes) {
List<Map<String, String>> packageCodeByCodes = baseMapper.findPackageCodeByCodes(orderPackageCodes);
if(CollUtil.isNotEmpty(packageCodeByCodes)){
if (CollUtil.isNotEmpty(packageCodeByCodes)) {
return packageCodeByCodes.stream().collect(Collectors.toMap(map -> map.get("code"), map -> String.valueOf(map.get("id"))));
}
return null;
}
}
@Override
public R findOrderDetails(OrderDetailsDTO orderDetailsDTO) {
//判断orderDetailsDTO中的订单号 运单号 包件码 服务号 客户车次号至少有一个有值
if(StringUtil.isBlank(orderDetailsDTO.getOrderCode()) && StringUtil.isBlank(orderDetailsDTO.getWaybillNo()) && StringUtil.isBlank(orderDetailsDTO.getOrderPackageCode()) && StringUtil.isBlank(orderDetailsDTO.getServiceNumber()) && StringUtil.isBlank(orderDetailsDTO.getTrunklineCarsNo())){
if (StringUtil.isBlank(orderDetailsDTO.getOrderCode()) && StringUtil.isBlank(orderDetailsDTO.getWaybillNo()) && StringUtil.isBlank(orderDetailsDTO.getOrderPackageCode()) && StringUtil.isBlank(orderDetailsDTO.getServiceNumber()) && StringUtil.isBlank(orderDetailsDTO.getTrunklineCarsNo())) {
return R.fail("订单号 运单号 包件码 服务号 客户车次号至少有一个有值");
}
@ -306,7 +312,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
orderDetailsDTO.setCreateTimeEnd(CommonUtil.getEndByDateStr(orderDetailsDTO.getCreateTimeEndStr()));
IPage<OrderDetailInfoVO> pageList = baseMapper.findOrderDetails(page,orderDetailsDTO);
IPage<OrderDetailInfoVO> pageList = baseMapper.findOrderDetails(page, orderDetailsDTO);
return R.data(pageList);
}
@ -327,7 +333,7 @@ public class TrunklineAdvanceDetailServiceImpl extends BaseServiceImpl<Trunkline
@Override
public void deletedAdvanceByOrderCode(String orderCode) {
if(StrUtil.isNotEmpty(orderCode)){
if (StrUtil.isNotEmpty(orderCode)) {
baseMapper.deletedAdvanceByOrderCode(orderCode);
}
}

Loading…
Cancel
Save