|
@@ -57,7 +57,7 @@ class GoodStockInfo extends Model
|
|
*/
|
|
*/
|
|
static function SaleBn($stockid,int $num,int $isstock=1){
|
|
static function SaleBn($stockid,int $num,int $isstock=1){
|
|
$arr = self::where([["balance_num",">",0]])->where(["stockid"=>$stockid])->select()->toArray();
|
|
$arr = self::where([["balance_num",">",0]])->where(["stockid"=>$stockid])->select()->toArray();
|
|
- if(empty($arr)) throw new Exception("库存批次数量不足","1006");
|
|
|
|
|
|
+ if(empty($arr)) throw new Exception("库存批次数量不足",1006);
|
|
$list=[];
|
|
$list=[];
|
|
foreach ($arr as $item) {
|
|
foreach ($arr as $item) {
|
|
$stock = self::name("good_stock")->where(["id"=>$item['stockid']])->field("id,usable_stock,wait_out_stock")->find()->toArray();
|
|
$stock = self::name("good_stock")->where(["id"=>$item['stockid']])->field("id,usable_stock,wait_out_stock")->find()->toArray();
|
|
@@ -79,10 +79,10 @@ class GoodStockInfo extends Model
|
|
$num=0;
|
|
$num=0;
|
|
}
|
|
}
|
|
$up=self::update($update,$item);
|
|
$up=self::update($update,$item);
|
|
- if($up==false) throw new Exception("库存批次库存更新失败","1006");
|
|
|
|
|
|
+ if($up==false) throw new Exception("库存批次库存更新失败",1006);
|
|
if($isstock==1) {
|
|
if($isstock==1) {
|
|
$stup=self::name("good_stock")->where($stock)->update($stockup);
|
|
$stup=self::name("good_stock")->where($stock)->update($stockup);
|
|
- if($stup==false) throw new Exception("库存更新失败","1006");
|
|
|
|
|
|
+ if($stup==false) throw new Exception("库存更新失败",1006);
|
|
|
|
|
|
}
|
|
}
|
|
$list[]=$temp;
|
|
$list[]=$temp;
|