wugg 2 năm trước cách đây
mục cha
commit
2651a7032a
1 tập tin đã thay đổi với 6 bổ sung2 xóa
  1. 6 2
      app/admin/controller/Purchin.php

+ 6 - 2
app/admin/controller/Purchin.php

@@ -1968,11 +1968,15 @@ class Purchin extends Base
 				$buadd= GoodStockInfo::AddBn($stockid,$info['bnCode'],$post['wsm_num'],$cgdinfo['good_price']);
 				if($buadd==false) throw new \Exception("库存bn更新失败");
 				//商品表里的'可用总库存数'增加
-              $upgood= Db::name('good')
+				$isGood= Db::name('good')->where(['is_del' => 0, 'spuCode' => $cgdinfo['spuCode']])->findOrEmpty();
+				if(!empty($isGood)){
+					$upgood= Db::name('good')
                                 ->where(['is_del' => 0, 'spuCode' => $cgdinfo['spuCode']])
                                 ->inc('usable_stock', $post['wsm_num'])
                                 ->update(['updatetime' => date('Y-m-d H:i:s')]);
-                if($upgood ==false)  throw new \Exception("商品库存更新失败");
+                    if($upgood ==false)  throw new \Exception("商品库存更新失败");
+				}
+
               if($upsend['error_num']>0){
               	 $returnCode=makeNo("CR");
                 $data=[