parent
9daa0151d9
commit
c2bdf9decd
13 changed files with 865 additions and 36 deletions
@ -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; |
||||
} |
||||
@ -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…
Reference in new issue