Jelajahi Sumber

Merge remote-tracking branch 'origin/dev_20260630' into dev_20260630

xucaiqin 7 jam lalu
induk
melakukan
e8ea72c536

+ 7 - 2
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/controller/enterpriseApp/AppWayBillController.java

@@ -282,8 +282,13 @@ public class AppWayBillController {
     @Operation(summary = "到达装货地点", description = "到达装货地点-手动推推送数据")
     @PostMapping("/comeInto")
     public BaseResult comeInto(@RequestBody @Valid WaybillOrderCmeIntoWeighParam param){
-        waybillOrderService.comeInto(param);
-        return BaseResult.success();
+        try {
+            waybillOrderService.comeInto(param);
+            return BaseResult.success();
+        } catch (Exception e) {
+            log.error("到达装货地点异常, param:{}, errorMessage:{}", param, e.getMessage(), e);
+            return BaseResult.failed(HttpStatus.GLOBAL_EXCEPTION_CODE, e.getMessage());
+        }
     }
 
 //    /**

+ 29 - 4
sckw-modules/sckw-transport/src/main/java/com/sckw/transport/service/app/WaybillOrderService.java

@@ -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.DictTypeEnum;
 import com.sckw.core.common.enums.enums.ErrorCodeEnum;
+import com.sckw.core.exception.BusinessException;
 import com.sckw.core.exception.BusinessPlatfromException;
 import com.sckw.core.model.constant.Global;
 import com.sckw.core.model.enums.AddressTypeEnum;
@@ -1288,12 +1289,16 @@ public class WaybillOrderService {
      */
     @Transactional(rollbackFor = Exception.class)
     public void comeInto(WaybillOrderCmeIntoWeighParam param) {
+        log.info("[过磅]开始过磅,入参参数:{}", JSON.toJSONString(param));
         if (StringUtils.isBlank(param.getTruckNo())){
             throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "车牌号不能为空!");
         }
         if (param.getWeighAmount() == null) {
             throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "称重重量不能为空!");
         }
+        if (param.getWeighbridgeId() == null) {
+            throw new BusinessPlatfromException(ErrorCodeEnum.PARAM_ERROR, "地磅id不能为空!");
+        }
         // 定义运单可以过磅的状态集合
         List<Integer> FORBIDDEN_STATUSES = Arrays.asList(
                 CarWaybillV1Enum.PENDING_VEHICLE.getCode(),
@@ -1305,12 +1310,32 @@ public class WaybillOrderService {
                 CarWaybillV1Enum.REPLENISHING.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);
     }