|
|
@@ -200,10 +200,9 @@ Class OrderCommodityService
|
|
|
$commodity_map[$key] = $commodity;
|
|
|
}
|
|
|
|
|
|
-
|
|
|
}
|
|
|
|
|
|
- public function getRegroupActAllocationDetails(&$orderHeaders,$owner_code_maps)
|
|
|
+ public function getRegroupActAllocationDetails(&$orderHeaders)
|
|
|
{
|
|
|
$map = [];
|
|
|
if($orderHeaders->count()==0) return $map;
|
|
|
@@ -234,7 +233,7 @@ Class OrderCommodityService
|
|
|
$owner = $dataHandlerService->getKeyValue(['id'=>$order->owner_id ?? ''],$owner_id_maps);
|
|
|
$key = "order_{($order->code ?? '')}_owner_code_{($owner->code)}_sku_{($orderCommodity->commodity->sku ?? '')}_location_{($orderCommodity->location)}";
|
|
|
if(empty($map[$key]))$map[$key]=[];
|
|
|
- $map[$key] =[
|
|
|
+ $map[$key][] =[
|
|
|
'id' => $orderCommodity->id,
|
|
|
'code' => $orderCommodity->order->code ?? '',
|
|
|
'sku' => $orderCommodity->commodity->sku,
|
|
|
@@ -246,11 +245,6 @@ Class OrderCommodityService
|
|
|
return $map;
|
|
|
}
|
|
|
|
|
|
- public function getUpdateParams(&$ActAllocationDetail_maps,&$orderCommodity_maps)
|
|
|
- {
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
public function getDeleteIds(&$ActAllocationDetail_maps,&$orderCommodity_maps)
|
|
|
{
|
|
|
$ids = [];
|
|
|
@@ -276,26 +270,28 @@ Class OrderCommodityService
|
|
|
return $params;
|
|
|
}
|
|
|
|
|
|
- public function getInnerParamsByParams($create_params,$owner_code_map,$order_code_map,$commodity)
|
|
|
+ public function getInnerParamsByParams($create_params,$order_code_map,$commodity_map)
|
|
|
{
|
|
|
/** @var DataHandlerService $dataHandlerService */
|
|
|
$dataHandlerService = app(DataHandlerService::class);
|
|
|
$inner_params = [];
|
|
|
- $data = (string) Carbon::now();
|
|
|
+ $date = (string) Carbon::now();
|
|
|
foreach ($create_params as $item) {
|
|
|
- $owner = $dataHandlerService->getKeyValue(['code'=>$item['owner_code']],$owner_code_map);
|
|
|
$order = $dataHandlerService->getKeyValue(['code'=>$item['code']],$order_code_map);
|
|
|
-// $key = "order_{$item['code']}_owner_code_{$item['owner_code']}_sku_{($orderCommodity->commodity->sku ?? '')}_location_{($orderCommodity->location)}";
|
|
|
+ $key = "_owner_code_{$item['owner_code']}_sku_{$item['sku']}";
|
|
|
+ $commodity = $commodity_map[$key] ?? null;
|
|
|
$inner_params[] = [
|
|
|
'order_id' => $order['id'] ?? '',
|
|
|
- 'commodity_id' => '',
|
|
|
- 'amount' => '',
|
|
|
- 'location' => '',
|
|
|
+ 'commodity_id' => $commodity['id'] ?? '',
|
|
|
+ 'amount' => $item['amount'],
|
|
|
+ 'location' => $item['location'],
|
|
|
+ 'created_at' => $date,
|
|
|
+ 'updated_at' => $date
|
|
|
];
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+ return $inner_params;
|
|
|
}
|
|
|
|
|
|
+
|
|
|
}
|
|
|
|