|
|
@@ -92,47 +92,31 @@ class InventoryCompareService
|
|
|
}
|
|
|
$creatingMissionCode = $this->getCreatingMissionCode($owner_name);
|
|
|
$commodityId=Commodity::where('sku',$sku)->where('owner_id',$owner_id)->value('id');
|
|
|
+ $params = [
|
|
|
+ 'owner_id' => $owner_id,
|
|
|
+ 'commodity_id' => $commodityId,
|
|
|
+ 'mission_code' => $creatingMissionCode,
|
|
|
+ 'custom_location' => $custom_location,
|
|
|
+ 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
|
|
+ 'amount_in_compare'=>$amount,
|
|
|
+ ];
|
|
|
if ($wmsInventoryCompareZp||$wmsInventoryCompareDj) {
|
|
|
- $wasInventoryCompareZP = [
|
|
|
- 'owner_id' => $owner_id,
|
|
|
- 'commodity_id' => $commodityId,
|
|
|
- 'mission_code' => $creatingMissionCode,
|
|
|
- 'custom_location' => $custom_location,
|
|
|
- 'created_at' => Carbon::now()->format('Y-m-d H:i:s'),
|
|
|
- 'quality' => '正品',
|
|
|
- 'amount_in_sys' => ($wmsInventoryCompareZp['在库数量'] ?? 0)+($wmsInventoryCompareDj['在库数量'] ?? 0),
|
|
|
- 'amount_in_compare' => $amount,
|
|
|
- 'differ' => $amount-(($wmsInventoryCompareZp['在库数量'] ?? 0) + ($wmsInventoryCompareDj['在库数量'] ?? 0)),
|
|
|
- ];
|
|
|
- array_push($wasInventoryCompares,$wasInventoryCompareZP);
|
|
|
+ $params['quality'] = '正品';
|
|
|
+ $params['amount_in_sys'] = ($wmsInventoryCompareZp['在库数量'] ?? 0)+($wmsInventoryCompareDj['在库数量'] ?? 0);
|
|
|
+ $params['differ'] = $amount-(($wmsInventoryCompareZp['在库数量'] ?? 0) + ($wmsInventoryCompareDj['在库数量'] ?? 0));
|
|
|
+ array_push($wasInventoryCompares,$params);
|
|
|
}
|
|
|
if ($wmsInventoryCompareCc){
|
|
|
- $wasInventoryCompareCC=[
|
|
|
- 'owner_id'=>$owner_id,
|
|
|
- 'commodity_id'=>$commodityId,
|
|
|
- 'mission_code'=>$creatingMissionCode,
|
|
|
- 'custom_location'=>$custom_location,
|
|
|
- 'created_at'=>Carbon::now()->format('Y-m-d H:i:s'),
|
|
|
- 'quality'=>'次品',
|
|
|
- 'amount_in_sys'=>$wmsInventoryCompareCc['在库数量'],
|
|
|
- 'amount_in_compare' =>$amount,
|
|
|
- 'differ' =>$amount-($wmsInventoryCompareCc['在库数量']??0),
|
|
|
- ];
|
|
|
- array_push($wasInventoryCompares,$wasInventoryCompareCC);
|
|
|
+ $params['quality'] = '次品';
|
|
|
+ $params['amount_in_sys'] = $wmsInventoryCompareCc['在库数量'];
|
|
|
+ $params['differ'] = $amount-($wmsInventoryCompareCc['在库数量']??0);
|
|
|
+ array_push($wasInventoryCompares,$params);
|
|
|
}
|
|
|
if ($wmsInventoryCompareYjz){
|
|
|
- $wasInventoryCompareYjz=[
|
|
|
- 'owner_id'=>$owner_id,
|
|
|
- 'commodity_id'=>$commodityId,
|
|
|
- 'mission_code'=>$creatingMissionCode,
|
|
|
- 'custom_location'=>$custom_location,
|
|
|
- 'created_at'=>Carbon::now()->format('Y-m-d H:i:s'),
|
|
|
- 'quality'=>'有价值',
|
|
|
- 'amount_in_sys'=>$wmsInventoryCompareYjz['在库数量'],
|
|
|
- 'amount_in_compare' =>$amount,
|
|
|
- 'differ' =>$amount-($wmsInventoryCompareYjz['在库数量']??0),
|
|
|
- ];
|
|
|
- array_push($wasInventoryCompares,$wasInventoryCompareYjz);
|
|
|
+ $params['quality'] = '有价值';
|
|
|
+ $params['amount_in_sys'] = $wmsInventoryCompareYjz['在库数量'];
|
|
|
+ $params['differ'] = $amount-($wmsInventoryCompareYjz['在库数量']??0);
|
|
|
+ array_push($wasInventoryCompares,$params);
|
|
|
}
|
|
|
if($unknownQualityStatus->isNotEmpty())continue;
|
|
|
}
|