Commit 53006ebb authored by hangjun83's avatar hangjun83

罗恩工具类更新

parent b26f6a2b
...@@ -99,7 +99,12 @@ class RhawnSoitemsRepositoryEloquent extends BaseRepository implements RhawnSoit ...@@ -99,7 +99,12 @@ class RhawnSoitemsRepositoryEloquent extends BaseRepository implements RhawnSoit
public function getOrderItemsStockFromItemIds($id) public function getOrderItemsStockFromItemIds($id)
{ {
$item = $this->find($id); if(!is_array($id)){
$item = $this->find($id);
$id = (array)$id;
}else{
$item = RhawnSoitems::query()->whereIn('si_id',$id)->get();
}
if(!$item){ if(!$item){
throw new \LogicException('该订单项不存在!',500); throw new \LogicException('该订单项不存在!',500);
} }
...@@ -109,7 +114,7 @@ class RhawnSoitemsRepositoryEloquent extends BaseRepository implements RhawnSoit ...@@ -109,7 +114,7 @@ class RhawnSoitemsRepositoryEloquent extends BaseRepository implements RhawnSoit
->join('dpdetail','dpdetail.si_id','soitems.si_id') ->join('dpdetail','dpdetail.si_id','soitems.si_id')
->join('pstock','pstock.pstk_id','dpdetail.pstk_id') ->join('pstock','pstock.pstk_id','dpdetail.pstk_id')
->join('products','soitems.p_id','products.p_id') ->join('products','soitems.p_id','products.p_id')
->where('soitems.si_id',$id) ->whereIn('soitems.si_id',$id)
->where('si_if_cancel',0) ->where('si_if_cancel',0)
//->where('dpdetail.dpd_invoiced','=',0) //->where('dpdetail.dpd_invoiced','=',0)
->get(); ->get();
......
...@@ -129,7 +129,7 @@ class RhawnOrdersService ...@@ -129,7 +129,7 @@ class RhawnOrdersService
//先查询库存信息 //先查询库存信息
$repository = app(RhawnSoitemsRepository::class); $repository = app(RhawnSoitemsRepository::class);
$stockResult = $repository->getOrderItemsStockFromItemIds($params['item_id']); $stockResult = $repository->getOrderItemsStockFromItemIds(explode(',',$params['item_id']));
if(empty($stockResult) || !$stockResult){ if(empty($stockResult) || !$stockResult){
throw new \LogicException('订单明细id不存在!',500); throw new \LogicException('订单明细id不存在!',500);
} }
...@@ -274,7 +274,7 @@ class RhawnOrdersService ...@@ -274,7 +274,7 @@ class RhawnOrdersService
} }
//获取销售订单item数据 //获取销售订单item数据
$result = app(RhawnSoitemsRepository::class)->getOrderItemsStockFromItemIds($content['item_id']); $result = app(RhawnSoitemsRepository::class)->getOrderItemsStockFromItemIds(explode(',',$content['item_id']));
$returnItemStock = []; $returnItemStock = [];
if($result && !empty($result)){ if($result && !empty($result)){
foreach($result as $res){ foreach($result as $res){
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment