|
@@ -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=[
|