shish vor 1 Jahr
Ursprung
Commit
5da0fb3538
1 geänderte Dateien mit 6 neuen und 7 gelöschten Zeilen
  1. 6 7
      app-hd/controllers/PurchaseController.php

+ 6 - 7
app-hd/controllers/PurchaseController.php

@@ -283,13 +283,6 @@ class PurchaseController extends BaseController
             $orderNum = [];
             foreach ($productList as $key => $product) {
                 $bigNum = $product['bigNum'] ?? 0;
-                if ($bigNum > intval($bigNum)) {
-                    util::fail('不能下单位,编号388');
-                }
-                $smallNum = $product['smallNum'] ?? 0;
-                if ($smallNum > 0) {
-                    util::fail('不能下小单位,编号800');
-                }
                 $productId = $product['productId'] ?? 0;
                 $orderNum[$productId] = ['num' => $bigNum];
             }
@@ -362,8 +355,14 @@ class PurchaseController extends BaseController
                         $allNoStock = true;
                         foreach ($productList as $pKey => $pVal) {
                             $productId = $pVal['productId'] ?? 0;
+                            $productName = $pVal['name'] ?? '';
                             if (isset($changeList[$productId])) {
+                                //解决剩下0.5扎和2.5扎,出现的异常情况
                                 $changeStock = $changeList[$productId];
+                                $changeStock = intval($changeStock);
+                                if ($changeStock < 1) {
+                                    util::fail($productName . '不足1扎,不能下单');
+                                }
                                 $productList[$pKey]['bigNum'] = $changeStock;
                             }
                             if ($productList[$pKey]['bigNum'] > 0) {