Sfoglia il codice sorgente

Merge branch 'master-new' into master-new-dev-wf

wufeng 2 anni fa
parent
commit
8282caec48
1 ha cambiato i file con 4 aggiunte e 5 eliminazioni
  1. 4 5
      app/admin/model/OrderOutChild.php

+ 4 - 5
app/admin/model/OrderOutChild.php

@@ -27,9 +27,9 @@ class OrderOutChild extends Model
         if ($sale['wsend_num'] < $out['send_num']) throw new \Exception("订单待发货数量不足");
         $num = $out['send_num'];
         $wsmlist = self::name("good_stock")->alias("a")
-            ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code and b.wsm_type in (2,5)")
+            ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code")
             ->field("a.id,a.usable_stock,a.wait_out_stock,b.wsm_code,b.supplierNo,b.supplierName")
-            ->where(["spuCode" => $sale['good_code'], "a.is_del" => 0, "b.companyNo" => $sale['supplierNo']])
+            ->where(["spuCode" => $sale['good_code'], "a.is_del" => 0,"b.wsm_type"=>[2,5], "b.companyNo" => $sale['supplierNo']])
             ->where("a.usable_stock", ">=", $num)
             ->order("a.usable_stock asc")
             ->findOrEmpty();
@@ -100,11 +100,10 @@ class OrderOutChild extends Model
 
         if (empty($child)) throw new Exception("工单信息不能为空");
         $stock = self::name("good_stock")->alias("a")
-            ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code and b.wsm_type in (2,5)")
-            ->where(["spuCode" => $child['spuCode'], "a.is_del" => 0, "b.companyNo" => $child['companyNo']])
+            ->leftJoin("warehouse_info b", "a.wsm_code=b.wsm_code")
+            ->where(["spuCode" => $child['spuCode'], "a.is_del" => 0,"b.wsm_type"=>[2,5], "b.companyNo" => $child['companyNo']])
             ->order("a.usable_stock desc")
             ->column("a.id,a.usable_stock,a.wait_out_stock,b.wsm_code,b.supplierNo,b.supplierName", "a.id");
-
         if (empty($stock)) throw new Exception("商品库存信息未找到");
         $wsmArr = self::GetKeyBySum($stock, intval($child['num']));
         if (empty($wsmArr)) throw new Exception("库存数不足生成工单");