|
@@ -55,7 +55,7 @@ class GoodStockInfo extends Model
|
|
|
* @throws \think\db\exception\DbException
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
*/
|
|
|
- static function SaleBn($stockid,int $num){
|
|
|
+ static function SaleBn($stockid,int $num,int $isstock=1){
|
|
|
$arr = self::where([["balance_num",">",0]])->where(["stockid"=>$stockid])->select()->toArray();
|
|
|
if(empty($arr)) throw new Exception("库存批次数量不足","1006");
|
|
|
$list=[];
|
|
@@ -82,7 +82,7 @@ class GoodStockInfo extends Model
|
|
|
$num=0;
|
|
|
}
|
|
|
self::update($update,$item);
|
|
|
- self::name("good_stock")->where($stock[$item['stockid']])->update($stockup);
|
|
|
+ $isstock==0 ?? self::name("good_stock")->where($stock[$item['stockid']])->update($stockup);
|
|
|
$list[]=$temp;
|
|
|
}
|
|
|
return $list;
|
|
@@ -113,8 +113,8 @@ class GoodStockInfo extends Model
|
|
|
* @throws \think\db\exception\DbException
|
|
|
* @throws \think\db\exception\ModelNotFoundException
|
|
|
*/
|
|
|
- static function OrderBn(string $orderCode, $stockid,int $num){
|
|
|
- $bnArr=self::SaleBn($stockid,$num);
|
|
|
+ static function OrderBn(string $orderCode, $stockid,int $num,int $isstock=1){
|
|
|
+ $bnArr=self::SaleBn($stockid,$num,$isstock);
|
|
|
if(empty($bnArr)) throw new Exception("未找到Bn库存数据",1006);
|
|
|
$ordBn=[];
|
|
|
foreach ($bnArr as $value){
|
|
@@ -235,4 +235,6 @@ class GoodStockInfo extends Model
|
|
|
}
|
|
|
return $result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
}
|