panlumeng 3 years ago
parent
commit
317ac96b37
1 changed files with 5 additions and 4 deletions
  1. 5 4
      app/admin/controller/Allot.php

+ 5 - 4
app/admin/controller/Allot.php

@@ -101,15 +101,16 @@ class Allot extends BaseController
                 "updatetime"=>date("Y-m-d H:i:s"),
             ];
             $pd=Db::name('allot_stock')->insert($data,true);
-            $dn = [];
+            $dm=[];
             if($pd>0) {
                 foreach ($dain as $value) {
                     $st = Db::name("good_type")->alias("b")->join("good a", "a.good_code = b.good_code", "left")
                         ->join("good_stock c", "c.good_type_code = b.type_code", "left")
                         ->join("warehouse_info v","v.wsm_code=c.wsm_code","left")
                         ->join("supplier n","n.code=v.supplierNo","left")
-                        ->where(['c.wsm_code' => $wsm_out, 'good_type_code' => $value['type_code'], 'b.is_del' => 0, 'a.is_del' => 0])->where("c.is_del=0 or c.is_del is null")
+                        ->where(['c.wsm_code' => $wsm_out, 'good_type_code' => $value['good_code'], 'b.is_del' => 0, 'a.is_del' => 0])->where("c.is_del=0 or c.is_del is null")
                         ->field("b.type_code,a.good_name,a.unit,c.wsm_code,c.usable_stock,c.good_type_code,c.wait_out_stock,c.wait_in_stock,n.name,n.code")->find();
+                   //var_dump(Db::name("good_type")->getLastSql());
                     if (empty($st)) {
                         Db::rollback();
                         return error_show(1003, "商品不能为空");
@@ -125,8 +126,8 @@ class Allot extends BaseController
                         $temp['stock_num'] = 0;
                         $temp['addtime'] = date("Y-m-d H:i:s");
                         $temp['updatetime'] = date("Y-m-d H:i:s");
-                        $dn[] = $temp;
-                        $io = db::name('allot_info')->insertAll($dn);
+                        $dm[]=$temp;
+                        $io = db::name('allot_info')->insertAll($dm);
                         if ($io) {
                             DB::commit();
                             return error_show(0, "调拨创建成功");