|
@@ -9,6 +9,7 @@ import com.google.common.collect.Lists;
|
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
import com.sckw.core.common.enums.enums.DictEnum;
|
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
import com.sckw.core.common.enums.enums.DictTypeEnum;
|
|
|
import com.sckw.core.common.enums.enums.ErrorCodeEnum;
|
|
import com.sckw.core.common.enums.enums.ErrorCodeEnum;
|
|
|
|
|
+import com.sckw.core.exception.BusinessException;
|
|
|
import com.sckw.core.exception.BusinessPlatfromException;
|
|
import com.sckw.core.exception.BusinessPlatfromException;
|
|
|
import com.sckw.core.model.constant.Global;
|
|
import com.sckw.core.model.constant.Global;
|
|
|
import com.sckw.core.model.enums.AddressTypeEnum;
|
|
import com.sckw.core.model.enums.AddressTypeEnum;
|
|
@@ -1288,12 +1289,16 @@ public class WaybillOrderService {
|
|
|
*/
|
|
*/
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public void comeInto(WaybillOrderCmeIntoWeighParam param) {
|
|
public void comeInto(WaybillOrderCmeIntoWeighParam param) {
|
|
|
|
|
+ log.info("[过磅]开始过磅,入参参数:{}", JSON.toJSONString(param));
|
|
|
if (StringUtils.isBlank(param.getTruckNo())){
|
|
if (StringUtils.isBlank(param.getTruckNo())){
|
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "车牌号不能为空!");
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "车牌号不能为空!");
|
|
|
}
|
|
}
|
|
|
if (param.getWeighAmount() == null) {
|
|
if (param.getWeighAmount() == null) {
|
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "称重重量不能为空!");
|
|
throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "称重重量不能为空!");
|
|
|
}
|
|
}
|
|
|
|
|
+ if (param.getWeighbridgeId() == null) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "地磅id不能为空!");
|
|
|
|
|
+ }
|
|
|
// 定义运单可以过磅的状态集合
|
|
// 定义运单可以过磅的状态集合
|
|
|
List<Integer> FORBIDDEN_STATUSES = Arrays.asList(
|
|
List<Integer> FORBIDDEN_STATUSES = Arrays.asList(
|
|
|
CarWaybillV1Enum.PENDING_VEHICLE.getCode(),
|
|
CarWaybillV1Enum.PENDING_VEHICLE.getCode(),
|
|
@@ -1305,12 +1310,32 @@ public class WaybillOrderService {
|
|
|
CarWaybillV1Enum.REPLENISHING.getCode(),
|
|
CarWaybillV1Enum.REPLENISHING.getCode(),
|
|
|
CarWaybillV1Enum.REPLENISH_FINISH.getCode()
|
|
CarWaybillV1Enum.REPLENISH_FINISH.getCode()
|
|
|
);
|
|
);
|
|
|
- List<KwtWaybillOrder> wbOrderByTruckNo = waybillOrderRepository.findWbOrderByTruckNoAndStatus(param.getTruckNo(), FORBIDDEN_STATUSES);
|
|
|
|
|
- if (CollectionUtils.isEmpty(wbOrderByTruckNo) || wbOrderByTruckNo.size() > 1) {
|
|
|
|
|
- throw new BusinessPlatfromException(ErrorCodeEnum.WAYBILL_ORDER_NOT_FOUND, "当前车辆没有可以称重过磅状态的运单");
|
|
|
|
|
|
|
+ List<KwtWaybillOrder> waybillOrders = waybillOrderRepository.findWbOrderByTruckNoAndStatus(param.getTruckNo(), FORBIDDEN_STATUSES);
|
|
|
|
|
+ // 称重过磅
|
|
|
|
|
+ if (CollectionUtils.isEmpty(waybillOrders)) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.WAYBILL_ORDER_NOT_FOUND, "[山上称重过磅]当前车辆没有称重过磅状态的运单!");
|
|
|
}
|
|
}
|
|
|
- param.setWaybillOrderId(wbOrderByTruckNo.get(0).getId());
|
|
|
|
|
|
|
+ try {
|
|
|
|
|
+ commonComeInto(param, waybillOrders, FORBIDDEN_STATUSES);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ log.error("[过磅]过磅异常", e);
|
|
|
|
|
+ throw new BusinessException("[过磅]过磅异常," + e.getMessage());
|
|
|
|
|
+ }
|
|
|
|
|
+ log.info("[过磅]过磅结束!");
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 655称重过磅
|
|
|
|
|
+ * @param param
|
|
|
|
|
+ * @param waybillOrders
|
|
|
|
|
+ * @param FORBIDDEN_STATUSES
|
|
|
|
|
+ */
|
|
|
|
|
+ private void commonComeInto(WaybillOrderCmeIntoWeighParam param, List<KwtWaybillOrder> waybillOrders, List<Integer> FORBIDDEN_STATUSES) {
|
|
|
|
|
+ if (waybillOrders.size() > 1) {
|
|
|
|
|
+ throw new BusinessPlatfromException(ErrorCodeEnum.WAYBILL_ORDER_NOT_FOUND, "[称重过磅]当前车辆过磅称重运单数据存在多条!");
|
|
|
|
|
+ }
|
|
|
|
|
+ KwtWaybillOrder waybillOrder = waybillOrders.get(0);
|
|
|
|
|
+ param.setWaybillOrderId(waybillOrder.getId());
|
|
|
comeIntoHandler.handler(param);
|
|
comeIntoHandler.handler(param);
|
|
|
}
|
|
}
|
|
|
|
|
|