wugg 1 year ago
parent
commit
ba8d5a1fe0

+ 1 - 1
app/admin/controller/CombindStock.php

@@ -231,7 +231,7 @@ class CombindStock extends Base
                 ActionLog::logAdd(['id'=>$this->uid,'nickname'=>$this->uname], $stn,  $row->flag==0?'ZHJC':'ZHTJ',
                  $param['status'],$param);
                 			$process=[
-                            'order_type' => $param['flag']==0?'ZHJC':'ZHTJ',
+                            'order_type' => $row->flag==0?'ZHJC':'ZHTJ',
                             'order_code' =>$row->stockCode,//出库单号
                             'order_id' => $row->id ,
                             'order_status' => $param['status'],

+ 1 - 1
app/admin/model/CombindStock.php

@@ -25,7 +25,7 @@ class CombindStock extends Model
    }
    
    public function CombindGood(){
-   		return $this->hasMany(GoodCombind::class,'spuCode','spuCode');
+   		return $this->hasMany(GoodCombind::class,'spuCode','spuCode')->where("is_del",0);
    }
    
    public function  getSpecInfoAttr($v,$row){

+ 7 - 1
app/admin/model/GoodCombind.php

@@ -13,7 +13,13 @@ class GoodCombind extends Model
 	protected $createTime="createtime";
 	protected $updateTime="updatetime";
 	protected $append=["usable_stock"];
-	
+	  // 定义全局的查询范围
+    protected $globalScope = ['is_del'];
+
+    public function scopeIsDel($query)
+    {
+        $query->where('is_del',0);
+    }
 	public function getUsableStockAttr($v,$row){
 		return (new GoodStock())->withJoin(['wsminfo'] , 'left')
 		                 ->where(['spuCode'=>$row['childCode'] , 'wsm_type'=>[2 , 5]])