gate("库存管理-补货列表"); $customer=$request->input('customer'); if (!$customer)$this->error('请选择指定货主!'); /** @var ReplenishmentService $service */ $service = app('ReplenishmentService'); $orders=$service->getOrderInfoRecentMonthByCustomer($customer); $skuArr=array_diff(array_unique(data_get($orders, '*.sku')), ['', '*', null]); $info=$service->getEaInventoryByCustomerAndSku($customer,$skuArr); $rsInfo=$service->getRsInventoryByCustomerAndSku($customer,$skuArr); //将整合后拣货位信息 结合订单汇总 foreach ($orders as &$order){ if(isset($info[$order['sku']])){ $item = $info[$order['sku']]; $order['amount']=($order['amount']-$item['qty']); $order['eaLocation']=$item['locationid']; }else{ $order['eaLocation']=[]; } if(isset($rsInfo[$order['sku']])){ $rsItem = $rsInfo[$order['sku']]; $order['rsLocation']=$rsItem['locationid']; }else{ $order['rsLocation']=[]; } } if (count($orders)>0)$this->success($orders); else $this->error('未查询到相应信息!'); } }