物流实体类提交

liweidong
liweidong-hj 1 month ago
parent 9daa0151d9
commit c2bdf9decd
  1. 4
      blade-common/src/main/java/org/springblade/common/constant/LauncherConstant.java
  2. 95
      blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/logistics/pojo/entity/Location.java
  3. 123
      blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/logistics/pojo/entity/OrderBind.java
  4. 89
      blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/logistics/pojo/entity/Station.java
  5. 134
      blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/logistics/pojo/entity/Task.java
  6. 71
      blade-service-api/blade-desk-api/src/main/java/org/springblade/desk/logistics/pojo/entity/WeighData.java
  7. 69
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/controller/PipelineController.java
  8. 40
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/mapper/WeighDataMapper.java
  9. 8
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/mapper/WeighDataMapper.xml
  10. 56
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/IPipelineService.java
  11. 49
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/IWeighDataService.java
  12. 86
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/impl/PipelineServiceImpl.java
  13. 77
      blade-service/blade-desk/src/main/java/org/springblade/desk/logistics/service/impl/WeighDataServiceImpl.java

@ -12,9 +12,9 @@ public interface LauncherConstant {
/**
* nacos 命名空间
*/
// String NACOS_NAMESPACE = "feaf627f-a847-463b-8b73-24a0538f526e";
String NACOS_NAMESPACE = "feaf627f-a847-463b-8b73-24a0538f526e";
// 生产环境
String NACOS_NAMESPACE = "db3f4da1-ae19-4104-8c17-6d9b8f069401";
// String NACOS_NAMESPACE = "db3f4da1-ae19-4104-8c17-6d9b8f069401";
// 测试环境
// String NACOS_NAMESPACE = "6cdd0310-0d61-4f54-891a-7fb06224d9b8";

@ -0,0 +1,95 @@
package org.springblade.desk.logistics.pojo.entity;
/**
* @author: liweidong
* @create: 2026-03-03
*/
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 物流库位实体类
*
* @author
* @since
*/
@Data
@TableName("LM_LOCATION")
@Schema(description = "物流库位对象")
@EqualsAndHashCode(callSuper = true)
public class Location extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 状态常量占用
*/
public static final Integer STATUS_OCCUPIED = 0;
/**
* 状态常量空闲
*/
public static final Integer STATUS_FREE = 1;
/**
* 库名称
*/
@Schema(description = "库名称")
private String locationName;
/**
* 库码
*/
@Schema(description = "库码")
private String locationCode;
/**
* 当前状态 0:占用 1:空闲
*/
@Schema(description = "当前状态 0:占用 1:空闲")
private Integer locationStatus;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 获取状态描述
* @return 状态描述
*/
public String getStatusDesc() {
if (STATUS_OCCUPIED.equals(this.locationStatus)) {
return "占用";
} else if (STATUS_FREE.equals(this.locationStatus)) {
return "空闲";
} else {
return "未知状态";
}
}
/**
* 判断是否为空闲
* @return true:空闲 false:非空闲
*/
public boolean isFree() {
return STATUS_FREE.equals(this.locationStatus);
}
/**
* 判断是否为占用
* @return true:占用 false:非占用
*/
public boolean isOccupied() {
return STATUS_OCCUPIED.equals(this.locationStatus);
}
}

@ -0,0 +1,123 @@
package org.springblade.desk.logistics.pojo.entity;
/**
* @author: liweidong
* @create: 2026-03-03
*/
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 订单绑定实体类
*
* @author
* @since
*/
@Data
@TableName("LM_ORDER_BIND")
@Schema(description = "订单绑定对象")
@EqualsAndHashCode(callSuper = true)
public class OrderBind extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 状态常量未绑定
*/
public static final Integer STATUS_UNBOUND = 0;
/**
* 状态常量已绑定
*/
public static final Integer STATUS_BOUND = 1;
/**
* 状态常量已解绑
*/
public static final Integer STATUS_UNBINDED = 2;
/**
* ID主键
*/
@Schema(description = "ID主键")
private Long id;
/**
* 订单ID
*/
@Schema(description = "订单ID")
private Long orderId;
/**
* 任务表ID
*/
@Schema(description = "任务表ID")
private Long taskId;
/**
* 状态 0:未绑定 1:已绑定 2:已解绑
*/
@Schema(description = "状态 0:未绑定 1:已绑定 2:已解绑")
private Integer bindingStatus;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 获取状态描述
* @return 状态描述
*/
public String getStatusDesc() {
return getStatusDesc(this.bindingStatus);
}
/**
* 根据状态值获取状态描述
* @param status 状态值
* @return 状态描述
*/
public static String getStatusDesc(Integer status) {
if (STATUS_UNBOUND.equals(status)) {
return "未绑定";
} else if (STATUS_BOUND.equals(status)) {
return "已绑定";
} else if (STATUS_UNBINDED.equals(status)) {
return "已解绑";
} else {
return "未知状态";
}
}
/**
* 判断是否已绑定
* @return true:已绑定 false:未绑定或已解绑
*/
public boolean isBound() {
return STATUS_BOUND.equals(this.bindingStatus);
}
/**
* 判断是否未绑定
* @return true:未绑定 false:已绑定或已解绑
*/
public boolean isUnbound() {
return STATUS_UNBOUND.equals(this.bindingStatus);
}
/**
* 判断是否已解绑
* @return true:已解绑 false:未绑定或已绑定
*/
public boolean isUnbinded() {
return STATUS_UNBINDED.equals(this.bindingStatus);
}
}

@ -0,0 +1,89 @@
package org.springblade.desk.logistics.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
/**
* 物流站点实体类
* @author: liweidong
* @create: 2026-03-03
*/
@Data
@TableName("LM_STATION")
@Schema(description = "物流站点对象")
@EqualsAndHashCode(callSuper = true)
public class Station extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 状态常量占用
*/
public static final Integer STATUS_OCCUPIED = 0;
/**
* 状态常量空闲
*/
public static final Integer STATUS_FREE = 1;
/**
* 站点名称
*/
@Schema(description = "站点名称")
private String stationName;
/**
* 站码
*/
@Schema(description = "站码")
private String stationCode;
/**
* 当前状态 0:占用 1:空闲
*/
@Schema(description = "当前状态 0:占用 1:空闲")
private Integer stationStatus;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 获取状态描述
* @return 状态描述
*/
public String getStatusDesc() {
if (STATUS_OCCUPIED.equals(this.stationStatus)) {
return "占用";
} else if (STATUS_FREE.equals(this.stationStatus)) {
return "空闲";
} else {
return "未知状态";
}
}
/**
* 判断是否为空闲
* @return true:空闲 false:非空闲
*/
public boolean isFree() {
return STATUS_FREE.equals(this.stationStatus);
}
/**
* 判断是否为占用
* @return true:占用 false:非占用
*/
public boolean isOccupied() {
return STATUS_OCCUPIED.equals(this.stationStatus);
}
}

@ -0,0 +1,134 @@
package org.springblade.desk.logistics.pojo.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
import java.math.BigDecimal;
/**
* 物流任务实体类
*
* @author: liweidong
* @create: 2026-03-03
*/
@Data
@TableName("LM_TASK")
@Schema(description = "物流任务对象")
@EqualsAndHashCode(callSuper = true)
public class Task extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 状态常量退回(超重)
*/
public static final Integer STATUS_RETURNED = 0;
/**
* 状态常量站点
*/
public static final Integer STATUS_STATION = 1;
/**
* 状态常量库位
*/
public static final Integer STATUS_LOCATION = 2;
/**
* 状态常量等待
*/
public static final Integer STATUS_WAITING = 3;
/**
* 状态常量回库
*/
public static final Integer STATUS_BACK_TO_STORAGE = 4;
/**
* 状态常量结束
*/
public static final Integer STATUS_FINISHED = 5;
/**
* ID主键
*/
@Schema(description = "ID主键")
private Long id;
/**
* 箱条码
*/
@Schema(description = "箱条码")
private String boxBarcode;
/**
* 站点ID
*/
@Schema(description = "站点ID")
private Long stationId;
/**
* 临时库位ID
*/
@Schema(description = "临时库位ID")
private Long locationId;
/**
* 当前状态 0:退回(超重) 1:站点 2:库位 3:等待 4:回库 5:结束
*/
@Schema(description = "当前状态 0:退回(超重) 1:站点 2:库位 3:等待 4:回库 5:结束")
private Integer taskStatus;
/**
* 重量
*/
@Schema(description = "重量(kg)")
private BigDecimal weight;
/**
* 机器重量(运输线的重量)
*/
@Schema(description = "机器重量(运输线的重量)")
private BigDecimal machineWeight;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
/**
* 获取状态描述
* @return 状态描述
*/
public String getStatusDesc() {
return getStatusDesc(this.taskStatus);
}
/**
* 根据状态值获取状态描述
* @param status 状态值
* @return 状态描述
*/
public static String getStatusDesc(Integer status) {
if (STATUS_RETURNED.equals(status)) {
return "退回(超重)";
} else if (STATUS_STATION.equals(status)) {
return "站点";
} else if (STATUS_LOCATION.equals(status)) {
return "库位";
} else if (STATUS_WAITING.equals(status)) {
return "等待";
} else if (STATUS_BACK_TO_STORAGE.equals(status)) {
return "回库";
} else if (STATUS_FINISHED.equals(status)) {
return "结束";
} else {
return "未知状态";
}
}
}

@ -0,0 +1,71 @@
package org.springblade.desk.logistics.pojo.entity;
/**
* @author: liweidong
* @create: 2026-03-03
*/
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import java.io.Serial;
import java.math.BigDecimal;
import java.util.Date;
/**
* 物流称重数据实体类
*
* @author
* @since
*/
@Data
@TableName("LM_WEIGH_DATA")
@Schema(description = "物流称重数据对象")
@EqualsAndHashCode(callSuper = true)
public class WeighData extends BaseEntity {
@Serial
private static final long serialVersionUID = 1L;
/**
* 退回状态常量已退回
*/
public static final Integer RETURN_STATUS_RETURNED = 0;
/**
* 退回状态常量未退回
*/
public static final Integer RETURN_STATUS_NOT_RETURNED = 1;
/**
* 箱条码
*/
@Schema(description = "箱条码")
private String boxBarcode;
/**
* 实际重量
*/
@Schema(description = "实际重量(单位:kg)")
private BigDecimal actualWeight;
/**
* 额定重量
*/
@Schema(description = "额定重量(单位:kg)")
private BigDecimal ratedWeight;
/**
* 退回状态 0:已退回 1:未退回
*/
@Schema(description = "退回状态 0:已退回 1:未退回")
private Integer returnStatus;
/**
* 备注
*/
@Schema(description = "备注")
private String remark;
}

@ -34,6 +34,9 @@ import org.apache.commons.lang3.StringUtils;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.tool.api.R;
import org.springblade.desk.basic.util.StatusCountMap;
import org.springblade.desk.logistics.service.IPipelineService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
@ -53,6 +56,9 @@ import java.math.BigDecimal;
@Tag(name = "输送线", description = "输送线接口")
public class PipelineController extends BladeController {
@Autowired
IPipelineService pipelineService;
/**
* 根据物料箱号查询已绑定预估重量
@ -61,22 +67,13 @@ public class PipelineController extends BladeController {
@ApiOperationSupport(order = 1)
@Operation(summary = "根据物料箱号查询已绑定预估重量", description = "传入箱条码")
public R estimatedWeight(@RequestParam String boxBarcode) {
// 1.参数校验
// 参数校验
if (StringUtils.isEmpty(boxBarcode)) {
throw new ServiceException("箱条码不能为空");
}
// todo 2.查询箱信息
// //Box box = boxMapper.selectByBarcode(boxBarcode);
// if (box == null) {
// throw new ServiceException("箱号不存在: " + boxBarcode);
// }
//
// // 3.检查是否已绑定
// if (!box.getBound()) {
// throw new ServiceException("该箱号未绑定预估重量");
// }
BigDecimal estimatedWeight = new BigDecimal(50);
BigDecimal estimatedWeight = pipelineService.getMaterialBoxWeight(boxBarcode);
return R.data(estimatedWeight);
}
@ -87,42 +84,46 @@ public class PipelineController extends BladeController {
summary = "验证输送箱实际重量",
description = "传入箱条码与实际重量,校验是否超重;若超重则解绑物料箱并指令放回输送线"
)
public R getBoundEstimatedWeight(
public R verifyConveyorBoxWeighing(
@Parameter(description = "物料箱条码", required = true)
@RequestParam String boxBarcode,
@Parameter(description = "实际称重重量(单位:kg)", required = true)
@RequestParam BigDecimal actualWeight) {
// 1.参数合法性校验
if (boxBarcode == null || boxBarcode.trim().isEmpty()) {
@RequestParam BigDecimal actualWeight,
@Parameter(description = "额定重量(单位:kg)", required = true)
@RequestParam BigDecimal ratedWeight,
@Parameter(description = "退回状态 0:退回 1:未退回", required = true)
@RequestParam Integer returnStatus
) {
// 参数校验
if (StringUtils.isBlank(boxBarcode)) {
return R.fail("箱条码不能为空");
}
if (actualWeight == null || actualWeight.compareTo(BigDecimal.ZERO) < 0) {
return R.fail("实际重量必须为非负数");
}
if (ratedWeight == null || ratedWeight.compareTo(BigDecimal.ZERO) < 0) {
return R.fail("额定重量必须为非负数");
}
if (null == returnStatus ) {
return R.fail("退回状态参数错误(0:退回 1:未退回)");
}
try {
// 2.根据箱条码查询物料箱基础信息
// 3.判断是否超重
BigDecimal ratedWeight = new BigDecimal(50);
int weightCompare = actualWeight.compareTo(ratedWeight);
if (weightCompare > 0) {
// 4.超重:执行解绑操作 + 指令放回输送线
// 超重处理完成返回
return R.data(
false,"物料箱[" + boxBarcode + "]超重(实际:" + actualWeight + "kg,额定:" + ratedWeight + "kg),已解绑并放回输送线"
);
boolean isPassed = pipelineService.verifyConveyorBoxWeighing(
boxBarcode, actualWeight, ratedWeight, returnStatus);
if (isPassed) {
String message = String.format("物料箱[%s]重量校验通过(实际:%skg,额定:%skg)",
boxBarcode, actualWeight, ratedWeight);
return R.data(true, message);
} else {
// 5.未超重:正常返回
return R.data(
true,"物料箱[" + boxBarcode + "]重量校验通过(实际:" + actualWeight + "kg,额定:" + ratedWeight + "kg)"
);
String message = String.format("物料箱[%s]超重(实际:%skg,额定:%skg),已解绑并放回输送线",
boxBarcode, actualWeight, ratedWeight);
return R.data(false, message);
}
} catch (Exception e) {
return R.fail("物料箱重量校验处理异常:" + e.getMessage());
return R.fail("处理异常:" + e.getMessage());
}
}

@ -0,0 +1,40 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.desk.logistics.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.springblade.desk.logistics.pojo.entity.WeighData;
/**
* 任务分派表 Mapper 接口
*
* @author BladeX
* @since 2025-11-12
*/
public interface WeighDataMapper extends BaseMapper<WeighData> {
}

@ -0,0 +1,8 @@
<?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 = "org.springblade.desk.logistics.mapper.WeighDataMapper">
</mapper>

@ -0,0 +1,56 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.desk.logistics.service;
import org.springblade.core.tool.api.R;
import java.math.BigDecimal;
/**
* 输送线 服务类
*
* @author BladeX
* @since 2025-11-12
*/
public interface IPipelineService {
/**
* 验证输送箱实际重量
* @param boxBarcode 箱条码
* @param actualWeight 实际重量
* @param ratedWeight 额定重量
* @param returnStatus 退回状态
* @return
*/
boolean verifyConveyorBoxWeighing(String boxBarcode, BigDecimal actualWeight, BigDecimal ratedWeight, Integer returnStatus);
/**
* 根据物料箱号查询已绑定预估重量
* @param boxBarcode
* @return
*/
BigDecimal getMaterialBoxWeight(String boxBarcode);
}

@ -0,0 +1,49 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.desk.logistics.service;
import org.springblade.core.mp.base.BaseService;
import org.springblade.desk.logistics.pojo.entity.WeighData;
import java.math.BigDecimal;
/**
* 物流称重存储 服务类
*
* @author BladeX
* @since 2025-11-12
*/
public interface IWeighDataService extends BaseService<WeighData> {
/**
* 新增
* @param boxBarcode
* @param actualWeight
* @param ratedWeight
* @param returnStatus
*/
void saveWeighingData(String boxBarcode, BigDecimal actualWeight, BigDecimal ratedWeight, Integer returnStatus);
}

@ -0,0 +1,86 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.desk.logistics.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.springblade.core.tool.api.R;
import org.springblade.desk.logistics.pojo.entity .WeighData;
import org.springblade.desk.logistics.service.IPipelineService;
import org.springblade.desk.logistics.service.IWeighDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* 工艺能力表 服务实现类
*
* @author BladeX
* @since 2025-11-12
*/
@Service
@Slf4j
public class PipelineServiceImpl implements IPipelineService {
@Autowired
IWeighDataService weighDataService;
@Override
public boolean verifyConveyorBoxWeighing(String boxBarcode, BigDecimal actualWeight, BigDecimal ratedWeight, Integer returnStatus) {
// 1. 保存称重数据
weighDataService.saveWeighingData(boxBarcode,actualWeight,ratedWeight,returnStatus);
// 2. 判断是否超重
if (WeighData.RETURN_STATUS_RETURNED.equals(returnStatus)) {
// todo 超重处理
return false;
} else {
// 正常重量
log.info("物料箱[{}]重量校验通过", boxBarcode);
return true;
}
}
@Override
public BigDecimal getMaterialBoxWeight(String boxBarcode) {
// todo 2.查询箱信息 根据箱条码查询物料箱信息
// //Box box = boxMapper.selectByBarcode(boxBarcode);
// if (box == null) {
// throw new ServiceException("箱号不存在: " + boxBarcode);
// }
//
// // 3.检查是否已绑定
// if (!box.getBound()) {
// throw new ServiceException("该箱号未绑定预估重量");
// }
BigDecimal estimatedWeight = new BigDecimal(50);
return estimatedWeight;
}
}

@ -0,0 +1,77 @@
/**
* BladeX Commercial License Agreement
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
* <p>
* Use of this software is governed by the Commercial License Agreement
* obtained after purchasing a license from BladeX.
* <p>
* 1. This software is for development use only under a valid license
* from BladeX.
* <p>
* 2. Redistribution of this software's source code to any third party
* without a commercial license is strictly prohibited.
* <p>
* 3. Licensees may copyright their own code but cannot use segments
* from this software for such purposes. Copyright of this software
* remains with BladeX.
* <p>
* Using this software signifies agreement to this License, and the software
* must not be used for illegal purposes.
* <p>
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
* not liable for any claims arising from secondary or illegal development.
* <p>
* Author: Chill Zhuang (bladejava@qq.com)
*/
package org.springblade.desk.logistics.service.impl;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.desk.logistics.mapper.WeighDataMapper;
import org.springblade.desk.logistics.pojo.entity.WeighData;
import org.springblade.desk.logistics.service.IWeighDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
/**
* 填报明细表 服务实现类
*
* @author BladeX
* @since 2025-11-12
*/
@Service
@Slf4j
public class WeighDataServiceImpl extends BaseServiceImpl<WeighDataMapper, WeighData> implements IWeighDataService {
@Autowired
WeighDataMapper weighDataMapper;
@Override
public void saveWeighingData(String boxBarcode, BigDecimal actualWeight, BigDecimal ratedWeight, Integer returnStatus) {
WeighData weighData = new WeighData();
weighData.setBoxBarcode(boxBarcode.trim());
weighData.setActualWeight(actualWeight);
weighData.setRatedWeight(ratedWeight);
weighData.setReturnStatus(returnStatus);
try {
// 执行插入
int result = weighDataMapper.insert(weighData);
if (result <= 0) {
throw new RuntimeException("保存称重数据失败");
}
log.info("称重数据保存成功:箱条码={},实际重量={}kg,额定重量={}kg,状态={}",
boxBarcode, actualWeight, ratedWeight,
WeighData.RETURN_STATUS_RETURNED.equals(returnStatus) ? "退回" : "未退回");
} catch (Exception e) {
log.error("称重数据保存失败:箱条码={}", boxBarcode, e);
throw new RuntimeException("保存称重数据异常:" + e.getMessage(), e);
}
}
}
Loading…
Cancel
Save