|
|
|
@ -24,15 +24,16 @@ |
|
|
|
* Author: Chill Zhuang (bladejava@qq.com) |
|
|
|
* Author: Chill Zhuang (bladejava@qq.com) |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
package org.springblade.desk.logistics.service.impl; |
|
|
|
package org.springblade.desk.logistics.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import org.springblade.core.tool.api.R; |
|
|
|
import org.springblade.desk.logistics.pojo.entity.Station; |
|
|
|
|
|
|
|
import org.springblade.desk.logistics.pojo.entity.Task; |
|
|
|
import org.springblade.desk.logistics.pojo.entity .WeighData; |
|
|
|
import org.springblade.desk.logistics.pojo.entity .WeighData; |
|
|
|
import org.springblade.desk.logistics.service.IPipelineService; |
|
|
|
import org.springblade.desk.logistics.service.IPipelineService; |
|
|
|
import org.springblade.desk.logistics.service.IWeighDataService; |
|
|
|
import org.springblade.desk.logistics.service.IStationService; |
|
|
|
|
|
|
|
import org.springblade.desk.logistics.service.ITaskService; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import java.math.BigDecimal; |
|
|
|
import java.math.BigDecimal; |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -46,21 +47,25 @@ import java.math.BigDecimal; |
|
|
|
public class PipelineServiceImpl implements IPipelineService { |
|
|
|
public class PipelineServiceImpl implements IPipelineService { |
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
@Autowired |
|
|
|
IWeighDataService weighDataService; |
|
|
|
ITaskService taskService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
|
|
|
IStationService stationService; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public boolean verifyConveyorBoxWeighing(String boxBarcode, BigDecimal actualWeight, BigDecimal ratedWeight, Integer returnStatus) { |
|
|
|
public boolean verifyConveyorBoxWeighing(String boxBarcode, BigDecimal actualWeight, BigDecimal ratedWeight, Integer returnStatus) { |
|
|
|
|
|
|
|
|
|
|
|
// 1. 保存称重数据
|
|
|
|
// 1. 判断是否超重
|
|
|
|
weighDataService.saveWeighingData(boxBarcode,actualWeight,ratedWeight,returnStatus); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 2. 判断是否超重
|
|
|
|
|
|
|
|
if (WeighData.RETURN_STATUS_RETURNED.equals(returnStatus)) { |
|
|
|
if (WeighData.RETURN_STATUS_RETURNED.equals(returnStatus)) { |
|
|
|
// todo 超重处理
|
|
|
|
// 2. 保存称重数据
|
|
|
|
|
|
|
|
taskService.savePipelineWeigh(boxBarcode,actualWeight, Task.STATUS_RETURNED); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// todo 3.超重处理,解绑
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
return false; |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
// 正常重量
|
|
|
|
// 2. 保存称重数据
|
|
|
|
|
|
|
|
taskService.savePipelineWeigh(boxBarcode,actualWeight, Task.STATUS_CONVEYOR_START); |
|
|
|
log.info("物料箱[{}]重量校验通过", boxBarcode); |
|
|
|
log.info("物料箱[{}]重量校验通过", boxBarcode); |
|
|
|
return true; |
|
|
|
return true; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -69,18 +74,37 @@ public class PipelineServiceImpl implements IPipelineService { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public BigDecimal getMaterialBoxWeight(String boxBarcode) { |
|
|
|
public BigDecimal getMaterialBoxWeight(String boxBarcode) { |
|
|
|
|
|
|
|
|
|
|
|
// todo 2.查询箱信息 根据箱条码查询物料箱信息
|
|
|
|
// 2.查询箱信息 根据箱条码查询物料箱信息
|
|
|
|
// //Box box = boxMapper.selectByBarcode(boxBarcode);
|
|
|
|
Task task = taskService.getBoxBarcode(boxBarcode); |
|
|
|
// if (box == null) {
|
|
|
|
if (null == task ) { |
|
|
|
// throw new ServiceException("箱号不存在: " + boxBarcode);
|
|
|
|
throw new ServiceException("查询不到该物料箱: "+boxBarcode); |
|
|
|
// }
|
|
|
|
} |
|
|
|
//
|
|
|
|
|
|
|
|
// // 3.检查是否已绑定
|
|
|
|
// 3.检查是否已绑定
|
|
|
|
// if (!box.getBound()) {
|
|
|
|
if (null == task.getWeight()) { |
|
|
|
// throw new ServiceException("该箱号未绑定预估重量");
|
|
|
|
throw new ServiceException("该箱号未绑定预估重量"); |
|
|
|
// }
|
|
|
|
} |
|
|
|
BigDecimal estimatedWeight = new BigDecimal(50); |
|
|
|
|
|
|
|
|
|
|
|
return task.getWeight(); |
|
|
|
return estimatedWeight; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public boolean receiveBoxArriveConveyorEnd(String boxBarcode) { |
|
|
|
|
|
|
|
Task task = taskService.getBoxBarcode(boxBarcode); |
|
|
|
|
|
|
|
if (null == task ) { |
|
|
|
|
|
|
|
throw new ServiceException("查询不到该物料箱: "+boxBarcode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(null == task.getStationId()){ |
|
|
|
|
|
|
|
throw new ServiceException("查询不到站点信息: "+boxBarcode); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//查询站点 判断站点是否为空
|
|
|
|
|
|
|
|
Station station = stationService.getById(task.getStationId()); |
|
|
|
|
|
|
|
if(Station.STATUS_FREE.equals(station.getStationStatus())){ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return false; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|